Re: Open a session based on the session id

2007-08-24 Thread Hernâni Henrique Ramos Cerqueira
Thanks, I always tough that with ajax requests cookies were not sended.
This is my first application that mixes ajax requests and session
tracking, and becaus I was not able to read session info, I immediately
assumed that (and i think i had read that somewhere). But the problem
was with the info... My bad, but thanks anyway.

Cheers,
Hernâni

Sex, 2007-08-24 às 10:39 -0400, Christopher Schultz escreveu:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hernâni,
> 
> > I'm developing a webapp that does lots of ajax requests, but I need to
> > keep track of the session. What I do is to read the JSESSIONID cookie
> > with javascript and send the value as a POST parameter when I make the
> > request, but then tomcat doesn't open the session automaticaly.
> 
> That's because Tomcat doesn't read POST parameters to look for a session
> id. You need to encode the session id in the URL if you are not sure
> that your browser will send a cookie.
> 
> Try something like this:
> 
> var sessionId =  ; read cookie
> var URL = "http://./foo/bar.baz;"; + sessionId + "?param=value&"
> Note that this is all very silly, since you're using javascript to sniff
> the sessionid from a cookie. If you already have a cookie, then the
> browser /is/ using cookies, and you don't need to do any of this since
> the browser will send the cookie to the server automatically.
> 
> - -chris
> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGzu2t9CaO5/Lv0PARAvURAJ9RXeteg31i2VconN67NaChphXtWgCgw207
> FwfauFTn+WvmJ9m/Aea/tmQ=
> =L5Bf
> -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]
> 


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



Open a session based on the session id

2007-08-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hernâni,

> I'm developing a webapp that does lots of ajax requests, but I need to
> keep track of the session. What I do is to read the JSESSIONID cookie
> with javascript and send the value as a POST parameter when I make the
> request, but then tomcat doesn't open the session automaticaly.

That's because Tomcat doesn't read POST parameters to look for a session
id. You need to encode the session id in the URL if you are not sure
that your browser will send a cookie.

Try something like this:

var sessionId =  ; read cookie
var URL = "http://./foo/bar.baz;"; + sessionId + "?param=value&"

Note that this is all very silly, since you're using javascript to sniff
the sessionid from a cookie. If you already have a cookie, then the
browser /is/ using cookies, and you don't need to do any of this since
the browser will send the cookie to the server automatically.

- -chris

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

iD8DBQFGzu2t9CaO5/Lv0PARAvURAJ9RXeteg31i2VconN67NaChphXtWgCgw207
FwfauFTn+WvmJ9m/Aea/tmQ=
=L5Bf
-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: Open a session based on the session id

2007-08-24 Thread Ben Souther
I've never had to deal with the session id in my own code.
Both Firefox and MSIE send it automatically when I make AJAX calls.





192.168.000.029.02446-192.168.000.020.08080: POST 
Accept: text/javascript, text/html, application/xml, text/xml, */*
Accept-Language: en-us
x-prototype-version: 1.5.0
Referer: http://192.168.0.20:8080/myContext/myPage
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR
1.1.4322)
Host: 192.168.0.20:8080
Content-Length: 36
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=1C00A7251D7BF3EB3499EDC37614A93B ===<<
 
 
192.168.000.029.02446-192.168.000.020.08080: criteria=a














> Hernâni Henrique Ramos Cerqueira wrote:
> > Hello all,
> > I'm developing a webapp that does lots of ajax requests, but I need to
> > keep track of the session. Wath i do is to read the JSESSIONID cookie
> > with javascript and send the value as a POST parameter when I make the
> > request, but then tomcat doesn't open the session automaticaly. My
> > question is the following: Is there a way of calling the rigth session
> > based on the session id passed on the post parameter?
> > 
> > Thanks in advance,
> > Cheers, Hernâni
> > 
> > 
> > -
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGzuXn9CaO5/Lv0PARAq+XAKCMPau4Sei6eR5etAR40Y1ijfcNawCfa+e8
> mxdcstbA6kTnokVMr7iiFQM=
> =ZbeP
> -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]


-
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: Open a session based on the session id

2007-08-24 Thread Hernâni Henrique Ramos Cerqueira
Sex, 2007-08-24 às 10:06 -0400, Christopher Schultz escreveu:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hernâni,
> 
> Don't hijack threads. Please post a new question.

???
> 
> - -chris
> 
> Hernâni Henrique Ramos Cerqueira wrote:
> > Hello all,
> > I'm developing a webapp that does lots of ajax requests, but I need to
> > keep track of the session. Wath i do is to read the JSESSIONID cookie
> > with javascript and send the value as a POST parameter when I make the
> > request, but then tomcat doesn't open the session automaticaly. My
> > question is the following: Is there a way of calling the rigth session
> > based on the session id passed on the post parameter?
> > 
> > Thanks in advance,
> > Cheers, Hernâni
> > 
> > 
> > -
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGzuXn9CaO5/Lv0PARAq+XAKCMPau4Sei6eR5etAR40Y1ijfcNawCfa+e8
> mxdcstbA6kTnokVMr7iiFQM=
> =ZbeP
> -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]
> 


-
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: Open a session based on the session id

2007-08-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hernâni,

Don't hijack threads. Please post a new question.

- -chris

Hernâni Henrique Ramos Cerqueira wrote:
> Hello all,
> I'm developing a webapp that does lots of ajax requests, but I need to
> keep track of the session. Wath i do is to read the JSESSIONID cookie
> with javascript and send the value as a POST parameter when I make the
> request, but then tomcat doesn't open the session automaticaly. My
> question is the following: Is there a way of calling the rigth session
> based on the session id passed on the post parameter?
> 
> Thanks in advance,
> Cheers, Hernâni
> 
> 
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzuXn9CaO5/Lv0PARAq+XAKCMPau4Sei6eR5etAR40Y1ijfcNawCfa+e8
mxdcstbA6kTnokVMr7iiFQM=
=ZbeP
-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]



Open a session based on the session id

2007-08-24 Thread Hernâni Henrique Ramos Cerqueira
Hello all,
I'm developing a webapp that does lots of ajax requests, but I need to
keep track of the session. Wath i do is to read the JSESSIONID cookie
with javascript and send the value as a POST parameter when I make the
request, but then tomcat doesn't open the session automaticaly. My
question is the following: Is there a way of calling the rigth session
based on the session id passed on the post parameter?

Thanks in advance,
Cheers, Hernâni


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