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 2004/03/05 19:05:33 UTC

DO NOT REPLY [Bug 27478] New: - cross context redirects don't work when import context redirects back to original context :

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

cross context redirects don't work when import context redirects back to original context :

           Summary: cross context redirects don't work when import context
                    redirects back to original context :
           Product: Tomcat 5
           Version: 5.0.19
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: adeshpande@clubmom-inc.com


I have discovered another problem, that somehow sessions are either getting lost
or mixed up when you do cross context imports  in at least one advanced scenario :

1) page Z in context 'a' import a page X from context 'b'
2) page X in context 'b' imports a page Y in context 'a'

in this case, the session that was created when you import page X in context b
is the session that's available in page Y in context a.

here's my test case  ---

test_page1.jsp ( context '/profile' ) :

   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   Test of cross context imports :
   <% request.getSession().setAttribute("test_attrib", "12345"); %>
   <% out.println("test_attrib in ( test_page1.jsp ) is " +
   session.getAttribute("test_attrib") ); %><br/>
   <% out.println("session id (  in test_page1.jsp) is : " +
   request.getSession().getId() ); %> <br/>
   <c:import url="/test_other.jsp" context="/" />

test_other.jsp ( context '/' ) :

   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <% request.getSession().setAttribute("test_other_attrib", "54321" );
%>
   <% out.println("test attrib ( in test_other.jsp ) is : " +
   request.getSession().getAttribute("test_attrib") ); %><br/>
   <% out.println("test other attrib ( in test_other.jsp) is : " +
   request.getSession().getAttribute("test_other_attrib") ); %><br/>
   <% out.println("session id (  in test_other.jsp) is : " +
   request.getSession().getId() ); %> <br/>
   <c:import url="/test_page2.jsp" context="/profile"/>

test_page2.jsp ( context '/profile' ) :

   <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
   <% out.println("test_attrib ( in test_page2.jsp ) is " +
   session.getAttribute("test_attrib") ); %> <br/>
   <% out.println("test other attrib ( in test_page2.jsp) is : " +
   request.getSession().getAttribute("test_other_attrib") ); %> <br/>
   <% out.println("session id (  in test_page2.jsp) is : " +
   request.getSession().getId() ); %> <br/>



The output i get when I hit test_page1.jsp is :


Test of cross context imports : test_attrib in ( test_page1.jsp ) is
12345
session id ( in test_page1.jsp) is : 2796EBFF6C413841B7B2D496D7E8FD3F
test attrib ( in test_other.jsp ) is : null
test other attrib ( in test_other.jsp) is : 54321
session id ( in test_other.jsp) is : 2796EBFF6C413841B7B2D496D7E8FD3F
test_attrib ( in test_page2.jsp ) is null
test other attrib ( in test_page2.jsp) is : 54321
session id ( in test_page2.jsp) is : 2796EBFF6C413841B7B2D496D7E8FD3F


The output I get when i hit test_other.jsp is :


test attrib ( in test_other.jsp ) is : null
test other attrib ( in test_other.jsp) is : 54321
session id ( in test_other.jsp) is : 55B2068D3011D727DF15068ADAD713E2
test_attrib ( in test_page2.jsp ) is null
test other attrib ( in test_page2.jsp) is : null
session id ( in test_page2.jsp) is : 55B2068D3011D727DF15068ADAD713E2


the output that i get when i hit test_page2.jsp :

test_attrib ( in test_page2.jsp ) is 12345
test other attrib ( in test_page2.jsp) is : null
session id ( in test_page2.jsp) is : 2796EBFF6C413841B7B2D496D7E8FD3F

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