You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/09/20 06:10:30 UTC
DO NOT REPLY [Bug 3736] New: -
incorrect PathInfo on first invocation of servlet chain
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3736>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3736
incorrect PathInfo on first invocation of servlet chain
Summary: incorrect PathInfo on first invocation of servlet chain
Product: Tomcat 4
Version: 4.0 Final
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: mrobinson@baltimore.com
consider two servlets, S3 and S4 (source below) where S3 includes S4,
determining S4's name from the PathInfo, e.g. the chain is invoked as follows
http://localhost/servlet/S3/servlet/S4
on the very first invocation S4 receives the incorrect ServletPath and PathInfo.
the example output is as follows:
Servlet S3
Servlet Path: /servlet/S3
Path Info: /servlet/S4
Servlet S4
Servlet Path: /servlet/S4
Path Info: null
note that if S3 had forwarded to rather than included S4, S4's output would be
correct.
on all subsequent invocations the correct info is received:
Servlet S3
Servlet Path: /servlet/S3
Path Info: /servlet/S4
Servlet S4
Servlet Path: /servlet/S3
Path Info: /servlet/S4
this works as expected with TC3.2.3
S3.java:
package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class S3
extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.getWriter().println("Servlet S3");
res.getWriter().println("Servlet Path: " +
req.getServletPath());
res.getWriter().println("Path Info: " + req.getPathInfo());
getServletContext().getRequestDispatcher(
req.getPathInfo()).include(req, res);
}
}
S4.java:
package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class S4
extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
res.getWriter().println("Servlet S4");
res.getWriter().println("Servlet Path: " +
req.getServletPath());
res.getWriter().println("Path Info: " + req.getPathInfo());
}
}