You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Sidney-Woollett <jo...@wardbrook.com> on 2004/02/13 11:16:50 UTC

TC 5.0.18 RequestDespatcher bug?

I think that there may be a bug in TC 5.0.18 when issuing a
RequestDespatcher.forward with an URL that has the jsessionid encoded in
the URL. My setup is RH 8, JDK 1.4.2_03 + Apache 1.3.29 + mod_jk + TC
5.0.18.

I have a servlet (mapped in web.xml to /home/*) which catches all URLs
starting with "/home/". The servlet "looks" at the URL to work out which
JSP page to render by forwarding to it. The service method code is as
follows:

String fwdURL = "/en/home/welcome.jsp";

//create the request dispatcher (for the new URL)
RequestDispatcher rqdD =
request.getRequestDispatcher(response.encodeURL(fwdURL));

//and forward the request
rqdD.forward(request, response);

Here is the error produced by TC

HTTP Status 404 -
/en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46

type Status report

message /en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46

description The requested resource
(/en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46) is not
available.
Apache Tomcat/5.0.18

Is this a bug, or am I doing something wrong. Maybe I should not be
encoding the forwarded URL. The bug manifests itself when switching from
an SSL to a non-SSL connection, or when cookies are turned off.

Thanks for any help.

John Sidney-Woollett

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


Re: TC 5.0.18 RequestDespatcher bug?

Posted by Tim Funk <fu...@joedog.org>.
Path parameters are not defined in section 8 of the spec but query string 
handling is. The ommision of discussing path parameters leads me to believe 
(ok interpret) that path info is not allowed for RequestDispathers.

-Tim

John Sidney-Woollett wrote:

> Tim Funk said:
> 
>>Without digging, I can't say if its a bug. BUT... There is no need to
>>encode the URL if the action is a RequestDispatcher.forward(). Only one
>>session may be associated with the live of a single request so once the
>>session is there in the request, its there no matter how many times in
>>the same request you do a RequestDispatcher.forward(). Encoding the URL
>>is only needed for sending redirects back to the client or for links on
>>pages.
> 
> 
> Thanks for the clarification - I'll remove the call to URLEncode for these
> situations.
> 
> Might still be a bug though... ;)
> 
> John
> 


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


Re: TC 5.0.18 RequestDespatcher bug?

Posted by John Sidney-Woollett <jo...@wardbrook.com>.
Tim Funk said:
> Without digging, I can't say if its a bug. BUT... There is no need to
> encode the URL if the action is a RequestDispatcher.forward(). Only one
> session may be associated with the live of a single request so once the
> session is there in the request, its there no matter how many times in
> the same request you do a RequestDispatcher.forward(). Encoding the URL
> is only needed for sending redirects back to the client or for links on
> pages.

Thanks for the clarification - I'll remove the call to URLEncode for these
situations.

Might still be a bug though... ;)

John




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


Re: TC 5.0.18 RequestDespatcher bug?

Posted by Tim Funk <fu...@joedog.org>.
Without digging, I can't say if its a bug. BUT... There is no need to encode 
the URL if the action is a RequestDispatcher.forward(). Only one session may 
be associated with the live of a single request so once the session is there 
in the request, its there no matter how many times in the same request you do 
a RequestDispatcher.forward(). Encoding the URL is only needed for sending 
redirects back to the client or for links on pages. (When the client is not 
accpeting cookies or hasn't yet receieved its first cookie)

-Tim

John Sidney-Woollett wrote:
> I think that there may be a bug in TC 5.0.18 when issuing a
> RequestDespatcher.forward with an URL that has the jsessionid encoded in
> the URL. My setup is RH 8, JDK 1.4.2_03 + Apache 1.3.29 + mod_jk + TC
> 5.0.18.
> 
> I have a servlet (mapped in web.xml to /home/*) which catches all URLs
> starting with "/home/". The servlet "looks" at the URL to work out which
> JSP page to render by forwarding to it. The service method code is as
> follows:
> 
> String fwdURL = "/en/home/welcome.jsp";
> 
> //create the request dispatcher (for the new URL)
> RequestDispatcher rqdD =
> request.getRequestDispatcher(response.encodeURL(fwdURL));
> 
> //and forward the request
> rqdD.forward(request, response);
> 
> Here is the error produced by TC
> 
> HTTP Status 404 -
> /en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46
> 
> type Status report
> 
> message /en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46
> 
> description The requested resource
> (/en/home/welcome.jsp;jsessionid=35CC14009BCF7CCED835634586378F46) is not
> available.
> Apache Tomcat/5.0.18
> 
> Is this a bug, or am I doing something wrong. Maybe I should not be
> encoding the forwarded URL. The bug manifests itself when switching from
> an SSL to a non-SSL connection, or when cookies are turned off.
> 


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