On Mon, 22 Jul 2002, Craig R. McClanahan wrote:

> In Servlet 2.4 (Community Draft 2), it looks like the language in Section
> 9.10 that describes this hasn't changed.  The basic rule is that you
> combine the "partial URLs" specified in the welcome file list to the
> incoming request for a "directory" resource in the WAR -- and if "a
> resource in the WAR is mapped that request URI" then it's supposed to be
> served by the servlet corresponding to the complete request URI.

And that can't work - if index.jsp is specified as index, then 
*.jsp mapping will allways match.

Acording the the servlet spec there is no requirement for index.jsp
to be present ( it can be precompied ), and no way to ask a servlet
like JspServlet if a request will work without executing it. 

So the only correct implementation would be to execute service() - 
and if the result is a 404 then we should try the next match.

However there is no guarantee that the extension-mapped servlet
will return 404 - in many cases servlets are using the pathinfo
to do some actions ( like Struts ) and may return something
valid.


> Catalina interprets the requirement as meaning that there has to be a
> static resource that matches.  This has the side effect that you can't use
> a regular servlet mapping that doesn't correspond to a static resource --
> if you could, that would mean that a welcome file like "foo.jsp" would
> match every time, even if there wasn't such a page in the specified
> directory, because of the "*.jsp" mapping.

I know. And I think you can't use index.do or pre-compiled jsps 
( unless you also have the jsp source files - which in many cases is 
not desirable ). 

3.3 has a similar implementation - and I don't think either implements 
the spec corectly. 

> It would seem that a web connector should at least be able to emulate what
> Catalina does, by checking for the existence of a static file in the
> webapp directory.

+1


> I don't know how you could implement a generic servlet matching a "welcome
> file" path, unless we were to exclude extension mapping and default
> servlet from the definition of "matching".  And I'm not sure that even
> that would do the right thing in all circumstances.

It's the index.jsp that worries me - combined with precompile jsps.

That could be an extremely common case - and will fail with the 
current implementation.

And of course, I would be good to know if it is at least possible
to implement this - and if not to have it fixed in the spec.

My proposal was to consider all exact and prefix mappings ( that
would cover precompiled jsps and struts ), as well as static files. 


Costin


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to