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 2002/01/25 17:09:15 UTC

DO NOT REPLY [Bug 6032] New: - Accessing a jsp directly behaves differently than accessing through a servlet-mapping.

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=6032>.
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=6032

Accessing a jsp directly behaves differently than accessing through a servlet-mapping.

           Summary: Accessing a jsp directly behaves differently than
                    accessing through a servlet-mapping.
           Product: Tomcat 4
           Version: 4.0.1 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: joseph.swiderski@ca.com


System - Windows NT Version 4.0 (Build 1381: Service Pack 6)

Apache Tomcat Version - 4.0.1 Final

Impact - Bug has a severe impact on our production software release. The 
inability to make the Reference Implementation work may have cascading effects 
on our product's usability with other containers (WebSphere, WebLogic, etc.).

Bug Summary:
When accessing the jsp directly, all is well.
127.0.0.1 - - "GET /tsgui001/tsgui001/gui.jsp HTTP/1.1" 200 1832
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/CoolGen_Make.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.html HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu_menu.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/CoolGen_MenuDom.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/gui.jsp?DYNAMIC=GETDATA HTTP/1.1" 200 -
127.0.0.1 - - "GET /tsgui001/CoolGen_Menutri.gif HTTP/1.1" 200 1135
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.css HTTP/1.1" 304 -

>From the web.xml:
<servlet>
    <servlet-name>gui</servlet-name>
    <jsp-file>/tsgui001/gui.jsp</jsp-file>
</servlet>
<servlet-mapping>
    <servlet-name>gui</servlet-name>
    <url-pattern>/gui</url-pattern>
</servlet-mapping>

When accessing the jsp via a servlet-mapping, a relative look up fails. Notice 
the 404 for CoolGen_Make.js.
127.0.0.1 - - "GET /tsgui001/gui HTTP/1.1" 200 1832
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /CoolGen_Make.js HTTP/1.1" 404 621
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.html HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu_menu.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/CoolGen_MenuDom.js HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/gui.jsp?DYNAMIC=GETDATA HTTP/1.1" 200 1135
127.0.0.1 - - "GET /tsgui001/CoolGen_Menutri.gif HTTP/1.1" 304 -
127.0.0.1 - - "GET /tsgui001/tsgui001/main_menu.css HTTP/1.1" 304 -

1. JSP /tsgui001/tsgui001/gui.jsp is requested via /tsgui001/gui.
2. gui.jsp forwards to a Servlet.
   <jsp:forward page="/servlet/tsgui001.GUI.ServletManager" />
3. The ServletManager streams the html page (no physical file on the file 
system).
4. The html page has an absolute reference to main_menu.js file:
   <HEAD>
    <SCRIPT LANGUAGE='JavaScript1.2' SRC='/tsgui001/tsgui001/main_menu.js' 
TYPE='text/javascript'></SCRIPT>
   </HEAD>
5. main_menu.js has an relative reference CoolGen_Make.js:
   document.write("<SCRIPT LANGUAGE=JavaScript SRC='../CoolGen_Make.js'>");

The differing behavior between the two access styles is unexpected and the 
specification does not list this as an expected behavior.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>