Java EE is a bit limited when it comes to mapping servlets to URLs.
Each webapplication is setup in a context such that http://yourhost:port/contextPath is a reference to a resource within the web application.
UrlMapping | URL | getServletPath() | getPathInfo() |
/* | http://yourhost:port/contextPath/anyPath/some.path.info | /anyPath/some.path.info | |
servletPath/* | http://yourhost:port/contextPath/servletPath/anyPath/some.path.info | /servletPath | /anyPath/some.path.info |
*.ext | http://yourhost:port/contextPath/anyPath/yourscript.ext | /anyPath/yourscript.ext | |
Not possible | http://yourhost:port/contextPath/anyPath/yourscript.ext/anyPath/some.path.info | /anyPath/yourscript.ext | /anyPath/some.path.info |
Unfortunately the "Not possible" scenario one we really want for CGI because a lot of scripts get information about what they are doing from the PATH_INFO variable.
eg mycontext/somePath/mywiki.php/pagename is common. The script somePath/mywiki.php expects to be executed with pagename as PATH_INFO
The PathInfoFilter solves this. It is mapped to a high level context (eg "/*") and takes a pathSpec init parameter (eg "*.php") and re-maps requests.
See the PathInfoFilter javadoc for usage.