tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: Tomcat4 and encodeURL
Date Sat, 03 Aug 2002 20:44:42 GMT


On 3 Aug 2002, Dominique Deleris wrote:

> Date: 03 Aug 2002 22:00:33 +0200
> From: Dominique Deleris <dominique.deleris@bluewin.ch>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user-list <tomcat-user@jakarta.apache.org>
> Subject: Tomcat4 and encodeURL
>
> Hi !
>
> I'm new to J2EE, and therefore I am trying each and every example
> of the programming book I've bought.
>
> Now I am learning session handling w/ the servlet API, and would
> like to use the URL-encoding style for keeping sessions, when the
> browser's configuration does not allow to use cookies.
>
> My (simple) example servlet is using the following instruction:
>       String lifeCycleURL = response.encodeURL("/jtests/servlet/lifeCycle");
>       out.println("<A href=\"" + lifeCycleURL + "?action=newSession\">");
>
> This should modify my URL, adding ";jsessionid=xxx" where xxx is
> the session ID. I can not get this to work, Tomcat will only
> handle sessions using cookies...
>
> Maybe I'm missing something?
>

Tomcat (or any other servlet container) will actually modify the URL only
under the following circumstances:

* There is actually a session in existence

* The URL you are encoding points back into the same webapp

* The container knows that cookies are not in use (because
  this is not the first request for the session, and we got
  the session id from the URL previously.

In your particular example, encoding would only take place if the context
path of your application is "jtests".  In addition, you must have called
request.getSession() to create the session *before* executing the
encodeURL call.

> I use :
> Tomcat 4.0.4
> Apache 1.3.26
> mod-jk
> Debian Woody (3.0)
>
> --
> Dominique Deleris
> http://potatoworld.tuxfamily.org
>
>

Craig


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


Mime
View raw message