Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-25 Thread Timothy Washington
Yeah. I had to bring that code up to the servlet level and strip it down before 
I saw it. It was buried between a lot of comments. So when you told me to look 
for the differences, it was like in pair-programming where someone points out 
the obvious. I knew it was something obvious!! 

Thanks for the extra brain ;)
Tim


- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Thursday, April 24, 2008 12:01:07 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Ok, got it. There was a buried 'response.rest()' call that I didn't
| see before.

response.reset?

- -chris





  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-24 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| The only thing is that in my real app, I send the response (via
| responseWriter) in my facade. Whereas in the EchoServlet, all
| processing is done in the servlet proper. I tried moving the response
| sending back up to the handling servlet and still no dice. I'll have
| to rip everything out and add stuff until I see where the breakage
| is.

I think a servlet re-write might be in order for the one that is not
working properly.

Write the skeleton with no calls to your business object and see if that
works (or just disable any calls to the business object) to see if your
cookie will be sent in that case.

Perhaps your business object is doing something nasty with the response.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQrq8ACgkQ9CaO5/Lv0PBquACdHcSLc7zaqyKXrTO58lZAPoZo
I/4An2au2LFexoMYezMgz/6SrVi5e6ff
=i3HD
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-24 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Ok, got it. There was a buried 'response.rest()' call that I didn't
| see before.

response.reset?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgQrsMACgkQ9CaO5/Lv0PDHBwCfcMOkNswlGmFg2yA/tAeno4+o
N8MAn2tFYfa+MFzozInwNWCH5A/7LCGR
=+vIw
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-24 Thread Timothy Washington

Ok, got it. There was a buried 'response.rest()' call that I didn't see before. 

Whew, thanks a lot for the feedback
Tim



- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Wednesday, April 23, 2008 5:38:59 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Oh, that's a good point. I actually have an EchoSservlet to test
| stuff like this and the JSESSIONID is being passed back in that case.
| I've copied it's process method which is called by doGet/doPost.

So, what's the difference between the one that works and the one that
doesn't?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPrHMACgkQ9CaO5/Lv0PCrUQCfU4pINQ1YpOFHu5nuubTJa647
YjoAoIvwM7lL9Cq7AMQj9xKyQAzad+S2
=gfzA
-END PGP SIGNATURE-

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


  __
Ask a question on any topic and get answers from real people. Go to Yahoo! 
Answers and share what you know at http://ca.answers.yahoo.com

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Timothy Washington
The only thing is that in my real app, I send the response (via responseWriter) 
in my facade. Whereas in the EchoServlet, all processing is done in the servlet 
proper. I tried moving the response sending back up to the handling servlet and 
still no dice. I'll have to rip everything out and add stuff until I see where 
the breakage is. 

Tim



- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Wednesday, April 23, 2008 5:38:59 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Oh, that's a good point. I actually have an EchoSservlet to test
| stuff like this and the JSESSIONID is being passed back in that case.
| I've copied it's process method which is called by doGet/doPost.

So, what's the difference between the one that works and the one that
doesn't?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPrHMACgkQ9CaO5/Lv0PCrUQCfU4pINQ1YpOFHu5nuubTJa647
YjoAoIvwM7lL9Cq7AMQj9xKyQAzad+S2
=gfzA
-END PGP SIGNATURE-

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


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Oh, that's a good point. I actually have an EchoSservlet to test
| stuff like this and the JSESSIONID is being passed back in that case.
| I've copied it's process method which is called by doGet/doPost.

So, what's the difference between the one that works and the one that
doesn't?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPrHMACgkQ9CaO5/Lv0PCrUQCfU4pINQ1YpOFHu5nuubTJa647
YjoAoIvwM7lL9Cq7AMQj9xKyQAzad+S2
=gfzA
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Timothy Washington

Oh, that's a good point. I actually have an EchoSservlet to test stuff like 
this and the JSESSIONID is being passed back in that case. I've copied it's 
process method which is called by doGet/doPost. 

LiveHTTPHeader output:
http://localhost:8080/webkell/echo

GET /webkell/echo 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
Connection: keep-alive

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=C190519696B6307CE7B04F53ACC890A6; Path=/webkell
Content-Length: 13
Date: Wed, 23 Apr 2008 21:23:44 GMT


EchoServlet.process:
public void process(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException { 


com.interrupt.bookkeeping.ISystem system = 

(com.interrupt.bookkeeping.ISystem)req.getSession().getAttribute("system"); 
PrintWriter pwriter = null; 
try { 

//... printing debug stuff


pwriter = new PrintWriter(resp.getOutputStream()); 
if(system == null) { 

pwriter.println("system NULL"); 
system = 
(com.interrupt.bookkeeping.ISystem)com.interrupt.bob.base.Bob.loadS( 

Bkell.class.getResourceAsStream("/bookkeeping.system.xml"), 
"xml/bookkeeping.system.xml" ); 
}
else { 
pwriter.println(system.toXML(false)); 
}
req.getSession().setAttribute("system", system); 

pwriter.close(); 

}
catch(IOException e) { 
e.printStackTrace(); 
}

}



- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Wednesday, April 23, 2008 1:58:03 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Timothy,

Timothy Washington wrote:
| Yes, the client and server are both on my localhost (I also tried
| 127.0.0.1), and that is the requesting/sending url. Hmmm, I tried
| setting that specific header (resp.addHeader("my-custom-header",
| "foo");), but there's no indication it's sending(from
| RequestDumpervalse output) or receiving(from LiveHTTPHeaders output)
| that header value.

That's totally weird.

Can you duplicate the offending servlet/action/JSP/whatever and start
removing things from it until it works?

- -chris


  __
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot 
with the All-new Yahoo! Mail.  Click on Options in Mail and switch to New Mail 
today or register for free at http://mail.yahoo.ca

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Timothy,

Timothy Washington wrote:
| Yes, the client and server are both on my localhost (I also tried
| 127.0.0.1), and that is the requesting/sending url. Hmmm, I tried
| setting that specific header (resp.addHeader("my-custom-header",
| "foo");), but there's no indication it's sending(from
| RequestDumpervalse output) or receiving(from LiveHTTPHeaders output)
| that header value.

That's totally weird.

Can you duplicate the offending servlet/action/JSP/whatever and start
removing things from it until it works?

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPeKsACgkQ9CaO5/Lv0PDLFACgoATSJKX3WCHTjRqo38K5i2Rk
eK0AoKTXj0W+ip9OoNUVT6jmTERHDzEP
=zn8X
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Timothy Washington

Yes, the client and server are both on my localhost (I also tried 127.0.0.1), 
and that is the requesting/sending url. Hmmm, I tried setting that specific 
header (resp.addHeader("my-custom-header", "foo");), but there's no indication 
it's sending(from RequestDumpervalse output) or receiving(from LiveHTTPHeaders 
output) that header value. 


LiveHTTPHeaders output: 
http://localhost:8080/webkell/webkell

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
Connection: keep-alive
Referer: http://localhost:8080/webkell/
Content-Type: application/x-www-form-urlencoded
Content-Length: 63
bkexpr=login+%28+user+-username+root+-password+password+%29%3B+
HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Content-Length: 96
Date: Wed, 23 Apr 2008 17:38:02 GMT


RequestDumperValve output:
DEBUG [http-8080-1] (ExpressionVisitor.java:620) - Login: userSession: 

END EchoServlet EV: 
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: ---
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO:   authType=null
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO:  contentLength=96
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO:contentType=null
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: cookie=JSESSIONID=FA7EBDD5908EEB626BDEBB45367D964C; 
domain=null; path=/webkell
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: header=Content-Length=96
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: header=Date=Wed, 23 Apr 2008 17:38:02 GMT
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO:message=null
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: remoteUser=null
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: status=200
Apr 23, 2008 1:38:02 PM org.apache.catalina.valves.RequestDumperValve invoke
INFO: ===


Tim


- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Wednesday, April 23, 2008 10:35:37 AM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Thanks for the feedback so far. I actually kept the interactions as
| simple as possible exactly to minimize any unknown behaviour. There's no
| SSL or filters in the application yet.

So, there's pretty much nothing in the way.

Where is your client in relation to Tomcat? Is this on localhost, or
over a network?

Is is possible that you have a firewall or proxy that is removing the
Set-Cookie header? I would imagine that some corporate firewalls do that
to enforce a no-cookies policy.

What if you try to set your own header on the response (before or after
the 'perform' method is invoked)? Try something like:

response.addHeader("my-custom-header", "foo");

...and see if that makes it back to the client.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPSTkACgkQ9CaO5/Lv0PCC5QCfZCdZ96e6JccC9e/KuwDVqKwL
87wAn29FZvSE+GJgmVlPJMFC+MLsrR/y
=0J/F
-END PGP SIGNATURE-

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


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tim,

Timothy Washington wrote:
| Thanks for the feedback so far. I actually kept the interactions as
| simple as possible exactly to minimize any unknown behaviour. There's no
| SSL or filters in the application yet.

So, there's pretty much nothing in the way.

Where is your client in relation to Tomcat? Is this on localhost, or
over a network?

Is is possible that you have a firewall or proxy that is removing the
Set-Cookie header? I would imagine that some corporate firewalls do that
to enforce a no-cookies policy.

What if you try to set your own header on the response (before or after
the 'perform' method is invoked)? Try something like:

response.addHeader("my-custom-header", "foo");

...and see if that makes it back to the client.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgPSTkACgkQ9CaO5/Lv0PCC5QCfZCdZ96e6JccC9e/KuwDVqKwL
87wAn29FZvSE+GJgmVlPJMFC+MLsrR/y
=0J/F
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Timothy Washington
Thanks for the feedback so far. I actually kept the interactions as simple as 
possible exactly to minimize any unknown behaviour. There's no SSL or filters 
in the application yet. So my code looks something like the following (by path 
of execution, I assume you mean the code's call sequence). So I'm not 
forwarding this to any other process, servlet, etc. I even tried downloading a 
fresh tomcat 6.0.16 server and doing a clean deploy. I get the same result. 

A. is the handling servlet that finds a system facade in the session. Then in 
B., that facade does some processing, spits out a response to the printwriter, 
and returns. A., then sets the changed facade back into the session and ends. 


A. 
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
...
SystemFacade bsfacade = 
(SystemFacade)(req.getSession(true).getAttribute(SystemFacade.FACADE_NAME));
...
bsfacade.perform(req, resp); 
req.getSession().setAttribute(FACADE_NAME, bsfacade);
...
}


B. 
public synchronized void perform(HttpServletRequest req, HttpServletResponse 
resp)
throws ServletException, IOException, InterruptedException {

 ... do some stuff 

PrintWriter pwriter = new PrintWriter(resp.getOutputStream()); 
pwriter.println(bkell.getPreviousCommandResult().toXML()); 
pwriter.close(); 

}


Because this is so simple, I figured I was missing something basic like a 
cookie setting in Tomcat. I tried commenting out 
req.getSession().setAttribute(FACADE_NAME, bsfacade);, thinking maybe that 
nulls out the JSESSIONID. But that has no effect. 


Tim



- Original Message 
From: Christopher Schultz <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Tuesday, April 22, 2008 10:20:25 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Len,

Len Popp wrote:
| Have you set cookies="false" in the app's  declaration?
| That'd do it.

That wouldn't explain why Tomcat is adding the cookie to the response,
but the cookie isn't making it across the wire.

Tim, can you tell us a little more about the path of execution? I'm
wondering if you are handling a request, modifying the response, and
then forwarding (on the server side) to another process that maybe
blanks-out the response and effectively kills the cookie or something
like that.

Is there any SSL involved at all? I wouldn't expect the behavior you
describe to result from crossing an SSL boundary (I would expect the
browser to get the cookie, but refuse to send it with the next request).

Are there any special filters or valves that are being applied that
might be modifying the behavior of the response?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgOnOkACgkQ9CaO5/Lv0PBUIQCdH1Q39DcjEM7dm6caLbHLEIrz
PuQAnRuxPKiKx10EnGbV9fyM2ENTLSit
=ULgz
-END PGP SIGNATURE-

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


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-23 Thread Timothy Washington

Hey, thanks for responding. I'm using Firefox 2.0.0.14, so it definitely 
supports cookies. It's just weird because it looks like the JSESSIONID cookie 
is not even being sent to it. I'll try URL encoding as a last resort. 

Tim



- Original Message 
From: Martin Gainty <[EMAIL PROTECTED]>
To: Tomcat Users List 
Sent: Tuesday, April 22, 2008 8:04:25 PM
Subject: Re: Tomcat not sending JSESSIONID (servlet session cookie) with new 
sessions

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.

http://www.idontknow.com/Idunno.html";)%>">Mongo
only pawn in game of life

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

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


  __
Ask a question on any topic and get answers from real people. Go to Yahoo! 
Answers and share what you know at http://ca.answers.yahoo.com

Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-22 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Len,

Len Popp wrote:
| Have you set cookies="false" in the app's  declaration?
| That'd do it.

That wouldn't explain why Tomcat is adding the cookie to the response,
but the cookie isn't making it across the wire.

Tim, can you tell us a little more about the path of execution? I'm
wondering if you are handling a request, modifying the response, and
then forwarding (on the server side) to another process that maybe
blanks-out the response and effectively kills the cookie or something
like that.

Is there any SSL involved at all? I wouldn't expect the behavior you
describe to result from crossing an SSL boundary (I would expect the
browser to get the cookie, but refuse to send it with the next request).

Are there any special filters or valves that are being applied that
might be modifying the behavior of the response?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgOnOkACgkQ9CaO5/Lv0PBUIQCdH1Q39DcjEM7dm6caLbHLEIrz
PuQAnRuxPKiKx10EnGbV9fyM2ENTLSit
=ULgz
-END PGP SIGNATURE-

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



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-22 Thread Len Popp
Have you set cookies="false" in the app's  declaration? That'd do it.

What happens if you put a trivial test.jsp in webapps/ROOT and request
http://www.yourserver.com/test.jsp? By default a JSP will create a
session and you should get a JSESSIONID cookie.
-- 
Len

On Tue, Apr 22, 2008 at 7:28 PM, Timothy Washington
<[EMAIL PROTECTED]> wrote:
> 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:  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]



Re: Tomcat not sending JSESSIONID (servlet session cookie) with new sessions

2008-04-22 Thread Martin Gainty
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.

 http://www.idontknow.com/Idunno.html";)%>">Mongo
only pawn in game of life

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

HTH
Martin-
- Original Message -
From: "Timothy Washington" <[EMAIL PROTECTED]>
To: 
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: 
> 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]