Last active
December 15, 2015 23:29
-
-
Save Vp3n/5340950 to your computer and use it in GitHub Desktop.
Handle CORS (Cross-Origin Resource Sharing) requests from any Java web application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- pom.xml, adding required dependency--> | |
<dependencies> | |
<dependency> | |
<groupId>com.thetransactioncompany</groupId> | |
<artifactId>cors-filter</artifactId> | |
<version>1.3.2</version> | |
</dependency> | |
</dependencies> | |
<!-- then setup filter on web.xml, this configuration allow everything : suitable for dev environment --> | |
<!-- more options and informations on http://software.dzhuvinov.com/cors-filter-configuration.html --> | |
<filter> | |
<filter-name>CORS</filter-name> | |
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> | |
<init-param> | |
<param-name>cors.supportedHeaders</param-name> | |
<param-value>Content-Type, X-Requested-With, Accept, Origin</param-value> | |
</init-param> | |
</filter> | |
<filter-mapping> | |
<filter-name>CORS</filter-name> | |
<servlet-name>servletName</servlet-name> | |
</filter-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment