P
Philippe Poulard
hi,
I use tomcat 5.0.28
I need to map all paths of my webapp to a single servlet except some
subpaths to the default servlet in order to serve some static resources
I did it like this :
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Unfortunately, I get a 404 not found for paths like this :
/myWebapp/static/foo.gif
Of course, I can't use a mapping that matches *.gif because MyServlet
can also handle *.gif paths others that /static/...
Then, I turned on the debug mode for the default servlet, and I get the
following trace :
HTTP Method : GET
Path Info : /foo.gif
Path translated : /path/to/jakarta-tomcat-5.0.28/webapps/myWebapp/foo.gif
Query string : null
Remote user : null
Requested session id : null
Request URI : /myWebapp/static/foo.gif
Context path : /myWebapp
Servlet path : /static
User principal : null
Ha !
I'm well aware that in many cases the servlet path have to be stripped
because it's a mapping artifact, but I do not understand why the
*default* servlet also strip it whereas in this case this part of the
path IS NOT a mapping artifact.
Wouldn't it be better if this servlet would accept an option that allow
users to choose which method have to be applied ("path translated" or
"real path") ?
Did I miss anything ?
--
Cordialement,
///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
I use tomcat 5.0.28
I need to map all paths of my webapp to a single servlet except some
subpaths to the default servlet in order to serve some static resources
I did it like this :
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Unfortunately, I get a 404 not found for paths like this :
/myWebapp/static/foo.gif
Of course, I can't use a mapping that matches *.gif because MyServlet
can also handle *.gif paths others that /static/...
Then, I turned on the debug mode for the default servlet, and I get the
following trace :
HTTP Method : GET
Path Info : /foo.gif
Path translated : /path/to/jakarta-tomcat-5.0.28/webapps/myWebapp/foo.gif
Query string : null
Remote user : null
Requested session id : null
Request URI : /myWebapp/static/foo.gif
Context path : /myWebapp
Servlet path : /static
User principal : null
Ha !
I'm well aware that in many cases the servlet path have to be stripped
because it's a mapping artifact, but I do not understand why the
*default* servlet also strip it whereas in this case this part of the
path IS NOT a mapping artifact.
Wouldn't it be better if this servlet would accept an option that allow
users to choose which method have to be applied ("path translated" or
"real path") ?
Did I miss anything ?
--
Cordialement,
///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |