tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22734] New: - Error combining <jsp:forward> and response.encodeURL()
Date Tue, 26 Aug 2003 19:26:44 GMT
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=22734>.
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=22734

Error combining <jsp:forward> and response.encodeURL()

           Summary: Error combining <jsp:forward> and response.encodeURL()
           Product: Tomcat 4
           Version: 4.1.27
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Duffy@Gillman.net


In my web application I have index.jsp forwarding to a struts action using the
following:

      <%@page contentType="text/html"%>
      <%String forwardTo = response.encodeURL("/home.do");%>
      <jsp:forward name="<%=forwardTo%>"/>

When a client first visits the site they get a 404 error stating "resource not
found" indicating that 'home.do;jsessionid=<yadda yadda>' could not be located.
 If the user hits reload, the page displays appropriately.

I found a post on comp.lang.java.programmer from an Emery Z. Balint Jr., dated
8/10/03, complaining of a similar problem.  In an email exchange he said he was
able to fix the problem by shutting off URL rewriting - a problem if the client
is a browser with cookies disabled.  It appears that both of our situations are
similar.  Here is a synopsis of the hypothesis I developed in an our email exchange:

"I removed the call to response.encodeURL() and the problem went away.  
Interestingly enough, I use encodeURL exclusively elsewhere in my 
application.  I do not encounter the same problem except in this instance 
where encodeURL is combined with a forward.  I anticipate that this is a 
result of the sequence of events that the servlet container goes through 
in establishing a session.  Perhaps a session is not fully registered 
until the completion of the first request-response cycle.  This would mean 
that the forward is trying to access a session object whose existence 
is not yet known to the rest of the servlet container.  The forward fails, 
but at the close of the transaction the session is fully 
created/registered/recognized, so the reload works."

And his response:
"Very interesting, you could be correct as to what is happening. Same for
me as well, no where else did the error occur, except for that first
time."

Mr. Balint and I are both using J2SE 1.4.1_02 and Tomcat 4.1.27.  I do not know
whether he is using Struts as well, though this seems immaterial.

Mime
View raw message