You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ashish Kulkarni <as...@gmail.com> on 2010/07/19 21:48:32 UTC

How to retrieve persisted session

Hi
I have configured my tomcat to save session in database as per
documentation, and it works as expected i can see the session is saved in
database,
Now if the user closes the browser, and then reopens i dont want to show the
login screen but get the session from database and go to the last visited
page,
how can i retrieve this session from database,
Normally our application checks for session, and a flag in session, if the
flag is on then user id logged in, but in my current application if i open
new browser window, it creates a new session,

any ideas

-- 
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

Re: How to retrieve persisted session

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
I am using the default, how do i set session expiry time, i can think of
only 1 place that is in web.xml

<session-config>
   <session-timeout>-1</session-timeout>
  </session-config>

Is there any other way


On Tue, Jul 20, 2010 at 10:25 AM, Pid <pi...@pidster.com> wrote:

> On 20/07/2010 14:58, Ashish Kulkarni wrote:
> > Hi
> > Where do i set this max age for session? i dont see any thing in document
> > http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html
>
> Have you manually set the session expiry time or are you using the default?
>
>
> p
>
> > Ashish
> >
> > On Mon, Jul 19, 2010 at 6:03 PM, Christopher Schultz <
> > chris@christopherschultz.net> wrote:
> >
> > Ashish,
> >
> > On 7/19/2010 4:48 PM, Ashish Kulkarni wrote:
> >>>> Is there a way i can save this session cookie, so i can access it
> later?
> > is
> >>>> it possible
> >
> > Set the maxAge of the session to something other than -1 (the default,
> > which means "this cookie will die when the browser shuts down").
> >
> >>>> How does yahoo or gmail keep me signed on for 2-3 days
> >
> > See above.
> >
> > -chris
> >>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
>
>
>


-- 
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

Re: How to retrieve persisted session

Posted by Pid <pi...@pidster.com>.
On 20/07/2010 14:58, Ashish Kulkarni wrote:
> Hi
> Where do i set this max age for session? i dont see any thing in document
> http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html

Have you manually set the session expiry time or are you using the default?


p

> Ashish
> 
> On Mon, Jul 19, 2010 at 6:03 PM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
> 
> Ashish,
> 
> On 7/19/2010 4:48 PM, Ashish Kulkarni wrote:
>>>> Is there a way i can save this session cookie, so i can access it later?
> is
>>>> it possible
> 
> Set the maxAge of the session to something other than -1 (the default,
> which means "this cookie will die when the browser shuts down").
> 
>>>> How does yahoo or gmail keep me signed on for 2-3 days
> 
> See above.
> 
> -chris
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>



Re: How to retrieve persisted session

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ashish,

On 7/20/2010 9:58 AM, Ashish Kulkarni wrote:
> Where do i set this max age for session? i dont see any thing in document
> http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html

You will have to write code to do this yourself: Tomcat won't do it for you.

Pid's question about setting the max inactive interval isn't germane,
because you want the JSESSIONID cookie to remain active across a browser
restart, rather than having the server hold on to the session longer
than it is. Setting <session-timeout> in web.xml (which is the same as
setting maxInactiveInterval on the <Manager>, though it's more standard)
will not affect the cookie lifetime on the client.

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

iEYEARECAAYFAkxGBYoACgkQ9CaO5/Lv0PCgBQCcC8/ysjc/bgmZzYXa3S6Ku0ji
qYcAn3Wf04f2J8jKCQIrTbvnqtXewGsZ
=7yJE
-----END PGP SIGNATURE-----

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


Re: How to retrieve persisted session

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
Where do i set this max age for session? i dont see any thing in document
http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html

Ashish

On Mon, Jul 19, 2010 at 6:03 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Ashish,
>
> On 7/19/2010 4:48 PM, Ashish Kulkarni wrote:
> > Is there a way i can save this session cookie, so i can access it later?
> is
> > it possible
>
> Set the maxAge of the session to something other than -1 (the default,
> which means "this cookie will die when the browser shuts down").
>
> > How does yahoo or gmail keep me signed on for 2-3 days
>
> See above.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkxEy5YACgkQ9CaO5/Lv0PAZhACfTxY8EWC5c1yhNbwA64AgLPRH
> 9NQAoKxsfFPaqiX/2WHLpZkcg6VAjAAw
> =4ABC
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

Re: How to retrieve persisted session

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ashish,

On 7/19/2010 4:48 PM, Ashish Kulkarni wrote:
> Is there a way i can save this session cookie, so i can access it later? is
> it possible

Set the maxAge of the session to something other than -1 (the default,
which means "this cookie will die when the browser shuts down").

> How does yahoo or gmail keep me signed on for 2-3 days

See above.

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

iEYEARECAAYFAkxEy5YACgkQ9CaO5/Lv0PAZhACfTxY8EWC5c1yhNbwA64AgLPRH
9NQAoKxsfFPaqiX/2WHLpZkcg6VAjAAw
=4ABC
-----END PGP SIGNATURE-----

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


Re: How to retrieve persisted session

Posted by Ashish Kulkarni <as...@gmail.com>.
Hi
Is there a way i can save this session cookie, so i can access it later? is
it possible

How does yahoo or gmail keep me signed on for 2-3 days
Ashish

On Mon, Jul 19, 2010 at 4:43 PM, Mark Thomas <ma...@apache.org> wrote:

> On 19/07/2010 20:48, Ashish Kulkarni wrote:
> > Hi
> > I have configured my tomcat to save session in database as per
> > documentation, and it works as expected i can see the session is saved in
> > database,
> > Now if the user closes the browser, and then reopens i dont want to show
> the
> > login screen but get the session from database and go to the last visited
> > page,
> > how can i retrieve this session from database,
>
> You can't. Once the browser is closed, the session cookie is removed
> from the browser.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Ashish
www.ayurwellness.com
www.mysoftwareneeds.com

Re: How to retrieve persisted session

Posted by Mark Thomas <ma...@apache.org>.
On 19/07/2010 20:48, Ashish Kulkarni wrote:
> Hi
> I have configured my tomcat to save session in database as per
> documentation, and it works as expected i can see the session is saved in
> database,
> Now if the user closes the browser, and then reopens i dont want to show the
> login screen but get the session from database and go to the last visited
> page,
> how can i retrieve this session from database,

You can't. Once the browser is closed, the session cookie is removed
from the browser.

Mark



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