1. Configure Cors Dependencies
Pom Added
<Dependency><groupId>Com.thetransactioncompany</groupId><Artifactid>Cors-filter</Artifactid><version>1.7</version></Dependency><Dependency><groupId>Com.thetransactioncompany</groupId><Artifactid>Java-property-utils</Artifactid><version>1.9</version></Dependency>
2. Configure the filter
Add the following configuration to Web. XML: (You must put the filter on top, otherwise it will not work)
<Filter> <Filter-name>CORS</Filter-name> <Filter-class>Com.thetransactioncompany.cors.CORSFilter</Filter-class> <Init-param> <Param-name>Cors.alloworigin</Param-name> <Param-value>*</Param-value> </Init-param><Init-param> <Param-name>Cors.supportedmethods</Param-name> <Param-value>GET, POST, HEAD, PUT, DELETE</Param-value> </Init-param> <Init-param> <Param-name>Cors.supportedheaders</Param-name> <Param-value>*</Param-value> </Init-param> <Init-param> <Param-name>Cors.exposedheaders</Param-name> <Param-value>Set-cookie</Param-value> </Init-param> <Init-param> <Param-name>Cors.supportscredentials</Param-name><Param-value>True</Param-value> </Init-param> </Filter> <filter-mapping> <Filter-name>CORS</Filter-name> <Url-pattern>/*</Url-pattern> </filter-mapping>
Configuration complete, restart, cross-domain problem solved!!
About server cross-domain issues (using cors resolution)