Giter VIP home page Giter VIP logo

jcors's Introduction

Welcome to the home of JCors

JCors is a simple and flexible Java implementation of W3C CORS spec.
See more details about CORS here

CORS?

CORS stands for Cross-Origin Resource Sharing and it’s a new way to enable client-side cross-origin requests.
Before CORS it was (almost) impossible to make Ajax requests to another domain because of ‘Same Origin Policy’ enforced by Javascript.
Some newest browsers already implement CORS support in order to make cross-domain client-side requests possible without the need of using hacks (such JSON-P).

And what exactly is JCors?

JCors is a small lib that provides a simple Servlet Filter that enables CORS request handling by existing Java resources.
These resources can be anything like webservices (REST / SOAP), Servlets, Struts Actions…

Using JCors

Just add this to your web.xml file:

<filter>
   <filter-name>CorsFilter</filter-name>
   <filter-class>org.jcors.web.CorsEnablingFilter</filter-class>
</filter>
	
<filter-mapping>
   <filter-name>CorsFilter</filter-name>
   <url-pattern>/resource/*</url-pattern>
</filter-mapping>

And optionally, add a file jcors.xml to your classpath
Check the jcors-sample.xml here

And Maven?

Now you can get JCors from Maven Central Repository:

<dependency>
   <groupId>org.jcors</groupId>
   <artifactId>jcors</artifactId>
   <version>1.2</version>
</dependency>

Help Me!

There are some things to improve on this project, can you help me?

  • Improve unit tests
  • Servlet 3.0 API support
  • Request Headers validation

About me

Email me: diegossilveira at gmail.com

Follow me: @diegossilveira

jcors's People

Contributors

diegossilveira avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.