Bug 42411 - DefaultServlet should use ServletPath + PathInfo
Summary: DefaultServlet should use ServletPath + PathInfo
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.23
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2007-05-14 09:10 UTC by Alex Burgel
Modified: 2007-05-14 09:52 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Alex Burgel 2007-05-14 09:10:13 UTC
currently the DefaultServlet only uses PathInfo to locate the file to serve. i
think it should use ServletPath + PathInfo to serve the file.

as it is now, it is impossible to use a servlet mapping like this:



if you make a request for '/images/blah.gif', ServletPath = '/images' and
PathInfo = '/blah.gif'.

so DefaultServlet will try to serve '/blah.gif' which doesn't exist because it
is in the '/images/' directory. if it used ServletPath + PathInfo, it will work
as expected.

making this change will not affect the current standard usage of DefaultServlet
(where its mapped to '/') because in that case ServletPath is null, so it only
uses PathInfo. it will also still work if people use a suffix mapping.

in the other case, where its is used with a path mapping like '/images/*', the
current behavior seems almost useless.
Comment 1 Remy Maucherat 2007-05-14 09:37:30 UTC
This is not going to be supported, however I encourage you to modify and use the
default servlet.
Comment 2 Alex Burgel 2007-05-14 09:52:27 UTC
ok, if thats the only option.

just out of curiosity, are you rejecting this cuz tomcat has always had this
behavior so why change it, or is there an actual reason for only using PathInfo?

i couldn't really think of a good reason for only using PathInfo, so i'm
interested to know if there is one.