tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan <stefan.rie...@telig.de>
Subject Re: Tomcat 5.5 redirect vs. forward behavior with welcome-file-list
Date Mon, 12 Feb 2007 21:36:32 GMT
Todd Gamber schrieb:
> In Tomcat 4.1, a request to a directory containing a welcome-file would
> *redirect* the user to a URL with any applicable welcome-file's name
> appended. In Tomcat 5.5, the request is instead *forwarded* to the welcome
> file.
>
> Is there a way to make Tomcat 5.5 act like Tomcat 4.1 in this respect?
>
> For example:
> I have a web.xml which contains:
> <welcome-file-list>
> 	<welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> In Tomcat 4.1, a request to http://www.mysite.com/directory/ makes the
> browser refresh with a URL of http://www.mysite.com/directory/index.jsp
>
> In Tomcat 5.5, the same request leaves the browser with the same URL
> http://www.mysite.com/directory/.
>
>
> BACKGROUND:
> I'm using Tomcat 5.5.17 on Windows XP, and unfortunately, my application is
> dependent on the redirect behavior of Tomcat 4.1 because my JSPs use
> HttpServletRequest.getRequestURI() to find the name of the JSPs themselves.
> The JSPs pull their content from the database based on the URL being
> requested. So, if the browser's URL bar reads
> http://www.mysite.com/directory/index.jsp, the 'index.jsp' queries the DB
> for content based on the path '/directory/index.jsp'. Conversely, if the
> browser's URL bar reads http://www.mysite.com/directory/, the same JSP looks
> for database rows using the path '/directory/'. Naturally, because Tomcat
> 5.5 acts differently, similar requests receive different content.
>
> I realize that populating content based on what's in the URL bar is not the
> best design, but I can't seem to find another way to definitively get the
> name of the actual JSP being requested. If anybody knows of a method similar
> to getRequestURI(), but which knows the name of the JSP being requested, it
> would help tremendously.
>
> Thanks,
> Todd
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   
Hi Todd,

I don't know if their is some configuration attribute but a servlet
filter could be an option.

Good luck

-- 
Stefan



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message