Cross Domain Scripting Enabling

I'm working with Tomcat and I am having some problems with Access-Control-Allow-Origin.

To my understanding, I can modify my web service's web.xml file to open the service up to the world. (Not sure how to do this for sure, but I don't want to anyway.)

How do I add a filter to allow specific websites to interact with it? eg,, and of course it's self.

The area of web.xml I believe should be modified is this...

    <description>My Description</description>
    <display-name>My Service's Display Name</display-name>
    <servlet-name>My Servlet's Name</servlet-name>
    <servlet-class>My Servlet's Class</servlet-class>

    <servlet-name>My Servlet's Name</servlet-name>

Do I use something like CORS and add...



Also, is it possible to do something like...


Thanks for any help!


I've had to go through the server owners since they have many filters already running and I don't want to interfere with the others.

However, others interested in doing this I finally found some nice documentation mainly...

Need Your Help

How to programmatically determine param name when constructing an ArgumentException?

.net reflection refactoring duplication

When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor ...

How does 'foreach' actually work?

php loops foreach iteration php-internals

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.