Tim
try
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponse
html
Encodes the specified URL by including the session ID in it, or,
if encoding is not needed, returns the URL unchanged.
The implementation of this method includes the logic to determine whether
the session ID needs to be encoded in the URL.

For example, if the browser supports cookies,
or session tracking is turned off,
URL encoding is unnecessary.

 <a
href="<%=response.encodeURL("http://www.idontknow.com/Idunno.html";)%>">Mongo
only pawn in game of life</a>

In your Servlet code
 response.sendRedirect(encodeRedirectURL(http://www.idontknow.html));

HTH
Martin-
----- Original Message -----
From: "Timothy Washington" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Tuesday, April 22, 2008 7:28 PM
Subject: Tomcat not sending JSESSIONID (servlet session cookie) with new
sessions


> Hello there - newbie question. I'm developing a browser-based application.
I i) copy the war file to the webapps/ directory, ii) startup tomcat and
iii) send an http request from Firefox.
>
> In my handling servlet, if a session doesn't exist for this client, then I
create one (via request.getSession(true)). I expect that cookie (and by
extension the session) to still be there on the next request. However,
tomcat's HTTP response to the first request does not include the JSESSIONID
cookie. So effectively my application is still only request scoped (tomcat
is creating a new session with each request).
>
> How can I get tomcat ( I've tried tomcat-5.5.25 and tomcat-6.0.16 ) to
reliably send the JSESSIONID cookie when a new session has been created? I
turned on Tomcat 6's RequestDumperValve, and got debugging info that
indicates that the JSESSIONID is being generated in the response. However,
when my browser receives the response, the cookie isn't there.
>
>
> Tomcat's RequestDumperValve Log (on response)
> END EchoServlet EV: <userSession xmlns='com/interrupt/bookkeeping/users'
id='686bbca4f757b9ab4bae280
> 3119786e7249-7ffb' groupid='webkell' userid='root' />
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO: ---------------------------------------------------------------
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:           authType=null
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:      contentLength=95
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:        contentType=null
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:             cookie=JSESSIONID=6014EF8C55BC4705D28863D117B1B334;
domain=null; path=/webkell
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:             header=Content-Length=95
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:             header=Date=Tue, 22 Apr 2008 23:18:35 GMT
> Apr 22, 2008 7:18:35 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:            message=null
> Apr 22, 2008 7:18:36 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:         remoteUser=null
> Apr 22, 2008 7:18:36 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO:             status=200
> Apr 22, 2008 7:18:36 PM org.apache.catalina.valves.RequestDumperValve
invoke
> INFO: ===============================================================
>
>
> Firefox Request Headers (from LiveHTTPHeaders):
> POST /webkell/webkell HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14)
Gecko/20080404 Firefox/2.0.0.14
> Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Referer: http://localhost:8080/webkell/
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 63
>
>
> Firefox Response Headers (from LiveHTTPHeaders):
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Content-Length: 95
> Date: Tue, 22 Apr 2008 23:18:35 GMT
>
>
> Thanks for any help
> Tim
>
>
>       __________________________________________________________________
> Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your
favourite sites. Download it now at
> http://ca.toolbar.yahoo.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to