i added into my web app a filter for cors origin.
The wweb app is deployed on localhost.
i would test the web serivce from a html5 project running at
http://localhost:8383/myappclient
the rest service is deployed on tomee and the endopoint is:
http://localhost:8080/backbone-jax-cellar/rest/wines
into web.xml file i added this filter:
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/rest/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
but is not working.
what it is the param <dispatcher>REQUEST</dispatcher>? is mandatory?
i have to add the annotation @OPTIONS to all method on the web service
for get working from another web app?
--
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus