Skip to content Skip to sidebar Skip to footer

How To Enable Cors In Jboss

I am developing an HTML5 application that has to obtain some values from legacy web-services (Jax-Ws) so I use jQuery.soap to query these web services to obtain responses. I have t

Solution 1:

You need to deal with your legacy web-services to fix the issue. As mccannf said above you need to add CORS filter in web.xml.

You can use a solution from thetransactioncompany:

web.xml:

<filter><filter-name>CORS</filter-name><filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class></filter><filter-mapping><filter-name>CORS</filter-name><url-pattern>*</url-pattern></filter-mapping>

maven:

<dependency><groupId>com.thetransactioncompany</groupId><artifactId>cors-filter</artifactId><version>2.5</version></dependency>

If you use apache Tomcat you can use built-in CorsFilter:

web.xml:

<filter><filter-name>CorsFilter</filter-name><filter-class>org.apache.catalina.filters.CorsFilter</filter-class></filter><filter-mapping><filter-name>CorsFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>

pom.xml:

<dependency><groupId>org.apache.tomcat</groupId><artifactId>tomcat-catalina</artifactId><version>7.0.42</version><scope>provided</scope></dependency>

Solution 2:

you can modify the standalone.xml file, if you are working locally.

modify your filters part of your xml as in the flollowing answer: https://stackoverflow.com/a/39215400/10623693

Solution 3:

I have solved this issue, disabling the WAPDL (Web Application Description Language) into the web.xml:

<servlet>
...
        <init-param><param-name>com.sun.jersey.config.feature.DisableWADL</param-name><param-value>true</param-value></init-param>
...
</servlet>

Post a Comment for "How To Enable Cors In Jboss"