You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jan Grant <Ja...@bristol.ac.uk> on 2001/04/11 11:54:32 UTC

tomcat 3.3m2: blah/ => blah/index.jsp: how to prevent this?

(Apologies for double sightings, mail barf)

I sent the original to tomcat-user but, on perusing the source, it
appears this list might be a better target.

On Tue, 10 Apr 2001, Jan Grant wrote:

> Using tomcat 3.1, I could create an index.jsp file which would display
> properly when the user requested the base directory.
>
> Under tomcat 3.2.1, a request for "blah/" generates a 302 redirect to
  (also 3.3m2)
> "blah/index.jsp" rather than just serving up the content of index.jsp!
>
> Is there any way to revert to the former (preferable) behaviour?

Hmm, looking closer it seems that according to
org/apache/tomcat/request/StaticInterceptor.java (3.2.1) or
src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java
(3.3m2)

       // Send redirect to the welcome file.
        // This is consistent with other web servers and avoids
        // gray areas in the spec - if the welcome file is a jsp,
        // what will be the requestPath - if it's the dir, then
        // jasper will not work. The original code created a
        // RequestDispatcher and the JSP will see an included
        // request, but that's not a specified behavior

I don't think that "behaving like other web servers" in this respect -
especially when it comes to a grey area of the spec - is a very good
idea... See
	http://www.w3.org/Provider/Style/URI
(item labelled "software mechanisms" in particular)

Currently, it appears that if I wish to avoid broadcasting my use of
JSPs, I've just got to code servlets and use those instead. This isn't
particularly satisfactory.

I know everyone's (justly) proud of tomcat, but there's no need to ram
the implementation mechanisms for a website down people's throats.

What's the likelihood of revising this decision?

Cheers,
jan

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287163 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk
Scrabble gematria: "BIBLE" = "DOGMA"



Re: tomcat 3.3m2: blah/ => blah/index.jsp: how to prevent this?

Posted by cm...@yahoo.com.
Hi Jan,

> > Under tomcat 3.2.1, a request for "blah/" generates a 302 redirect to
>   (also 3.3m2)
> > "blah/index.jsp" rather than just serving up the content of index.jsp!

> Currently, it appears that if I wish to avoid broadcasting my use of
> JSPs, I've just got to code servlets and use those instead. This isn't
> particularly satisfactory.

Use web.xml to define mappings. You can associate any name to any .jsp
file.

> I know everyone's (justly) proud of tomcat, but there's no need to ram
> the implementation mechanisms for a website down people's throats.

This isn't the reason - I just wanted to make sure everything works  and
we avoid some bugs ( which is quite important ). This is the cleanest
solution ( as oposed to some dirty hacks in 3.1 - which resulted in quite
a few bugs ). 

The real problem was the communication between jasper and tomcat, and most
of this is resolved in 3.3 ( in JspInterceptor - but we still support
JspServlet ).


> What's the likelihood of revising this decision?

Likely - after we finish refactoring jasper or if we have too much free
time or if you send a patch ( after running all watchdog and sanity
tests ! ). ( but even in that case, this will be an optional thing you can
specify in your server.xml, with the current behavior as default )


Costin


Re: tomcat 3.3m2: blah/ => blah/index.jsp: how to prevent this?

Posted by Jan Grant <Ja...@bristol.ac.uk>.
[further to this]

Looking at the proposed final draft of the 2.3 spec, it seems that
redirecting to a welcome file isn't specified: the request should be
forwarded instead - at least, the way I read the specs for
javax.servlet.RequestDispatcher, together with section 8.4 and 9.9

Cheers,
jan

On Wed, 11 Apr 2001, Jan Grant wrote:

> (Apologies for double sightings, mail barf)
>
> I sent the original to tomcat-user but, on perusing the source, it
> appears this list might be a better target.
>
> On Tue, 10 Apr 2001, Jan Grant wrote:
>
> > Using tomcat 3.1, I could create an index.jsp file which would display
> > properly when the user requested the base directory.
> >
> > Under tomcat 3.2.1, a request for "blah/" generates a 302 redirect to
>   (also 3.3m2)
> > "blah/index.jsp" rather than just serving up the content of index.jsp!
> >
> > Is there any way to revert to the former (preferable) behaviour?
>
> Hmm, looking closer it seems that according to
> org/apache/tomcat/request/StaticInterceptor.java (3.2.1) or
> src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java
> (3.3m2)
>
>        // Send redirect to the welcome file.
>         // This is consistent with other web servers and avoids
>         // gray areas in the spec - if the welcome file is a jsp,
>         // what will be the requestPath - if it's the dir, then
>         // jasper will not work. The original code created a
>         // RequestDispatcher and the JSP will see an included
>         // request, but that's not a specified behavior
>
> I don't think that "behaving like other web servers" in this respect -
> especially when it comes to a grey area of the spec - is a very good
> idea... See
> 	http://www.w3.org/Provider/Style/URI
> (item labelled "software mechanisms" in particular)
>
> Currently, it appears that if I wish to avoid broadcasting my use of
> JSPs, I've just got to code servlets and use those instead. This isn't
> particularly satisfactory.
>
> I know everyone's (justly) proud of tomcat, but there's no need to ram
> the implementation mechanisms for a website down people's throats.
>
> What's the likelihood of revising this decision?
>
> Cheers,
> jan
>
>

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287163 Fax +44 (0)117 9287112 RFC822 jan.grant@bris.ac.uk
( echo "ouroboros"; cat ) > /dev/fd/0 # it's like talking to yourself sometimes