We are currently using a Jersey JAX-RS implementation to handle our REST requests (server-side Jersey). Our web.xml file is configured so all /rest/* requests are handled by Jersey. That’s fine. Our server is currently Tomcat6, and using Java6 ( on Ubuntu 11.04 )
So, ://myserver/rest/customer/ is ok and Jersey calls the class with @Path(“/customer”) prefix.
Now we also have static content, for example ://myserver/images/… wich loads fine.
Is there a way to do so that we can get rid of the /rest/* prefix and mix it all together?
What we want to achieve :
://myserver/rest/customer/ → Jersey
://myserver/rest/images/ → the native image Directory of the war
Thanks for your help
This is pretty easy to achieve. Just register Jersey ServletContainer in web.xml as a filter (instead of servlet) – see the bottom of this page for an example – and either use ServletContainer.PROPERTY_WEB_PAGE_CONTENT_REGEX or ServletContainer.FEATURE_FILTER_FORWARD_ON_404 init param to make the static content accessible.