https://issues.apache.org/bugzilla/show_bug.cgi?id=55220

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
(In reply to japgolly from comment #3)
> My servlet is mapped to /* so shouldn't that pickup /foo?

It depends what other mappings are present. The mapping rules are set out in
section 12 of the Servlet 3.0 spec but there are also additional rules for
welcome files in section 10.10.


> When you say "the rules for welcome files will be applied" can you help me
> understand where/how that happens? Ideally I'd like a way to disable or
> preempt those rules in my Tomcat instance.

Having re-read the relevant parts of the spec and Tomcat's source code I think
my welcome file suggestion is wrong.

Mapping requests to servlets happens in the Mapper fairly early on in the
request processing and is defined by the sections of the servlet spec quoted
above. There is no way to disable a specific rule short of writing your own
Mapper component.

> I'm asking because there are many
> frameworks these days that expect to catch all requests in a single servlet
> and route internally. This isn't an isolated use case.

Indeed - which is why this is a little odd. I'd have expected to have seen a
lot more complaints.

Having looked at this again, I don't currently underdstand why you are seeing
the behaviour your are given the information you have provided. I can't
reproduce it and neither can I see how it might happen by looking at the code.

For an app with a context path of '/context', a servlet mapped to '/*' and a
directory foo the following will happen (see [1] for the code) for a request to
/foo:

1. Rule 1 doesn't match since there are no exact matches.
2. Rule 2 matches since /* matches.

The redirect from /foo to /foo/ doesn't occur until rule 7.

Given the behaviour you are seeing there is clearly soemthing else going on.
Can you provide the simplest possible test web application that demonstrates
this issue?



[1]
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?view=annotate

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to