You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hua Hou <hu...@handango.com> on 2003/04/25 01:07:22 UTC

Is this a Tomcat bug?

I am using Tomcat 4.1.24 and I have the following webapps setup

webapps/include, which is a context and has the following jsp files:
  XB.jsp and XC.jsp
  In XB.jsp, I have <jsp:include page="XC.jsp"/>

webapps/siteA, which is another context and has the following jsp file:
  XA.jsp, inside XA.jsp I have the following code

	ServletContext thisContext = getServletContext();
	ServletContext includeContext = thisContext.getContext("/include");
	includeContext.getRequestDispatcher("/XB.jsp").include(request, new
ServletResponseWrapperInclude(response, out));

The log file is as following:

2003-04-24 14:51:28 JspEngine --> /XC.jsp
2003-04-24 14:51:28 	     ServletPath: /XA.jsp
2003-04-24 14:51:28 	        PathInfo: null
2003-04-24 14:51:28 	        RealPath:
D:\TomCat4\bin\..\webapps\siteA\XC.jsp
2003-04-24 14:51:28 	      RequestURI: /siteA/XA.jsp
2003-04-24 14:51:28 	     QueryString: null
2003-04-24 14:51:28 	  Request Params: 


Should the real path be "D:\TomCat4\bin\..\webapps\include\XC.jsp"? Am I
missing something here? Is this a bug?

Thanks.

Hua

PS: Here is what I found from JspRuntimeLibrary.java file:
==========================================================
    public static void include(HttpServletRequest request,
                               HttpServletResponse response,
                               String relativePath,
                               JspWriter out,
                               boolean flush)
        throws IOException, ServletException {

        if (flush && !(out instanceof BodyContent))
            out.flush();

        // FIXME - It is tempting to use request.getRequestDispatcher() to
        // resolve a relative path directly, but Catalina currently does not
        // take into account whether the caller is inside a
RequestDispatcher
        // include or not.  Whether Catalina *should* take that into account
        // is a spec issue currently under review.  In the mean time,
        // replicate Jasper's previous behavior

        String resourcePath = getContextRelativePath(request, relativePath);
        System.out.println("Resource Path = " + resourcePath);
        RequestDispatcher rd = request.getRequestDispatcher(resourcePath);

        rd.include(request,
                   new ServletResponseWrapperInclude(response, out));

    }
==========================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org