Home > Uncategorized > Cross Domain scripting settings on Tomcat

Cross Domain scripting settings on Tomcat

February 23rd, 2011 Leave a comment Go to comments

In last post we had explained how to configure Apache to allow cross domain scripting. details can be found here

Cross domain Scripting problem with XmlHttp

If you do not plan to use Apache and for some reasons using tomcat or any other similar web container which supports filter, here is a ready made solution, Cors Filter

This gives you a servlet filter which is compatible with any Java Servlet 2.5+ web container.

Installation is very simple. Add the jar to your libraries

In you web.xml

add this line

<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>

And you are all set

Categories: Uncategorized Tags:
  1. April 9th, 2013 at 05:39 | #1

    @jatin

    me too…. I can`t start

  2. November 18th, 2011 at 08:18 | #2

    Is CORS filter packed with your war file ? TRy putting the cors.jar in lib of tomcat.

  3. jatin
    November 17th, 2011 at 22:13 | #3

    I am getting the following error.

    Can you plz help?
    java.lang.ClassNotFoundException: com.thetransactioncompany.cors.CORSFilter

  1. December 15th, 2011 at 04:53 | #1
  2. April 23rd, 2012 at 01:17 | #2