Matt Parker wrote:
I'd like to suggest that catalina perform a forward, rather than a
redirect, for requests that end with '/'. With a redirect, special
configuration is necessary for proxy servers to work correctly. Also, a
forward doesn't require an additional round trip to the client--a
redirect must get back to the client and the client then issues a new
request. I've tested this under Linux. Thanks!
You mean requests that do _not_ end with '/', right? Unfortunatly,
you must do a redirect in this case so that the browser can resolve
relative paths in the page correctly. If you use a forward, it can't
do so correctly.

Hans

--- DefaultServlet.java 2003-01-03 16:20:23.000000000 -0700
+++ DefaultServlet.java.new 2003-01-03 16:20:18.000000000 -0700
@@ -942,26 +942,18 @@
if (!request.getRequestURI().endsWith("/")) {
String redirectPath = path;
- String contextPath = request.getContextPath();
- if ((contextPath != null) && (!contextPath.equals("/"))) {
- redirectPath = contextPath + redirectPath;
- }
if (!(redirectPath.endsWith("/")))
redirectPath = redirectPath + "/";
redirectPath = appendParameters(request, redirectPath);
- response.sendRedirect(redirectPath);
+ request.getRequestDispatcher(redirectPath).forward(request, response);
return;
}
ResourceInfo welcomeFileInfo = checkWelcomeFiles(path, resources);
if (welcomeFileInfo != null) {
String redirectPath = welcomeFileInfo.path;
- String contextPath = request.getContextPath();
- if ((contextPath != null) && (!contextPath.equals("/"))) {
- redirectPath = contextPath + redirectPath;
- }
redirectPath = appendParameters(request, redirectPath);
- response.sendRedirect(redirectPath);
+ request.getRequestDispatcher(redirectPath).forward(request, response);
return;
}




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

--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


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

Reply via email to