Hi list I have a question regarding the servlet-mapping property in web.xml. Normally a url would look like this:
http://host:port/context/servlet-path As many others I have tried to setup my servlet so that it matches the following: http://host:port/ I’m trying to obtain this by using the following url-mapping: <servlet-mapping> <servlet-name>ServletAdaptor</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> I have read the answers on these two links: http://stackoverflow.com/questions/4140448/difference-between-and-in-servlet-mapping-url-pattern <http://stackoverflow.com/questions/4140448/difference-between-and-in-servlet-mapping-url-pattern> http://stackoverflow.com/questions/10874188/jax-rs-application-on-the-root-context-how-can-it-be-done <http://stackoverflow.com/questions/10874188/jax-rs-application-on-the-root-context-how-can-it-be-done> It’s still not clear to me why this doesn’t work (using Tomcat 7.0) I’ve have turned on Jersey tracing and this is what I get (on a url like this http://localhost:8080/emner/81.20.00): X-Jersey-Tracing-004:MATCH [ ---- / 1,00 ms | ---- %] Matching path [/] What’s puzzling to me is that it seems that for some reason my path gets stripped away before reaching the servlet. I would have expected something like this instead: X-Jersey-Tracing-004:MATCH [ ---- / 19,39 ms | ---- %] Matching path [/emner/81.20.00] Is it so in Tomcat, that when you use the url-pattern “/“ that the rest of path is ignored when interpreting the original url? Is it different using other containers? Could be related to this: http://bluxte.net/musings/2006/03/29/servletpath-and-pathinfo-servlet-api-weirdness <http://bluxte.net/musings/2006/03/29/servletpath-and-pathinfo-servlet-api-weirdness> With regards, Rune Stilling
