jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: welcome files and filters

From: Remy Maucherat <rmaucher_at_redhat.com>
Date: Fri, 29 Jun 2012 09:46:33 +0200

On Fri, 2012-06-29 at 00:15 -0700, Rajiv Mordani wrote:
> Mark has filed an issue on JIRA -
> http://java.net/jira/browse/SERVLET_SPEC-7 which basically is about
> clarifying the behavior for filters with welcome files. In the example
> with the filed issue - he has
>
> If a user requests "/foo" and "/foo" is a directory, the welcome files
> "index.jsp" and "index.html" are configured and "index.html" is
> present then what is compared against the filter mappings. Is it
> "/foo" or "/foo/index.html".
>
> The suggestion is to go with the filter mapping should be compared
> to /foo/index.html and not /foo.

Welcome files are not specified as a request dispatcher forward done by
the default servlet, or anything similar, so it is (relatively) obvious
to me that the request gets modified before going into the webapp, which
means all it sees is the full welcome path ("/foo/index.html"). So
filters use that as well.

> I think that this is a reasonable expectation - what do others think?
> However the question that I have (and I don't think this is clarified
> in the spec either) is what happens in the case where there is no
> welcome file and the default servlet is invoked. Should the filter
> mapping in that case be compared to /foo or /foo/<DefaultServlet>. I
> think it should still be /foo/<DefaultServlet> but would like to get
> input from others.

If there's no welcome file, I don't see why the path should be modified.
I don't understand what "/foo/<DefaultServlet>" means actually
("/foo/" ?).

> Comments / Suggestions?

If the existing container behavior changes, that will probably beak
things.

-- 
Remy Maucherat <rmaucher_at_redhat.com>
Red Hat Inc