-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Kiran,

On 9/7/15 12:54 PM, Kiran Badi wrote:
> I have few attributes saved in session they seems to living for
> close to 30 minutes which is session timeout in web xml.
> 
> I need to kill the session once the browser closes on the client
> side.

You need to free server resources, or you want the client to be
disconnected from their (old) session?

> Is their a way to do it on server side rather than doing via some
> kind of ajax handler.

Yes and no.

If you have the cookie set with no expiration date (the default with
Tomcat's container-managed sessions), then the browser will forget the
cookie when it closes.

If you *do* have an expiration date on your cookies, then AJAX is the
only way, and there's no guarantee that the browser is actually going
to send that AJAX message when it's closing the page.

If you want the serer to kill the session immediately upon browser
close (regardless of "expiration" date), your only hope is AJAX, and I
can tell you right now you shouldn't bet on that working.

> Doing it via ajax means injecting that code in all my jsp's and
> have lot many.

Sounds like session cookies are the way to go.

Perhaps you should think about using a leaner session, and then
sessions living for longer than necessary won't be such a big problem.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJV8DVQAAoJEBzwKT+lPKRYG4gP/0qOpYTP5D0xmPVZAaHFAhFY
Guz8sdBXxnfWlYwWYDZMcbtpOjpi91i5N9W42X0oeFTttkXH5Dzvfo7TpYo9OPnv
RRNdQZncehtlH0nZKjU7rnDFkiCUBWr6/LiblJikOMleItCZDfDIUpmakX7mgs+w
P0Y976SgdIPVxFjlqXc+Pgxnup6t8lFcNmrBPe93Jmb9QxzL1o4qcevdTz7KVdwo
BRKPHOEAGXTawcJM9E14e2tUa/8J+M7kTovoCkxjK5+VQSi+2k5KDmMDlxEdn6iO
HPSwpvsHxNyWd21rREIQhNfWOADYar5+phw5g+ifGtRxfhbY+cGzD2DzfrsUkZQB
+a0iGf9OgQb/wFIONWZbbx1zl6IQTiajZjuKuSfA5CXYDLbnyfsIMQ1Y77tlSZIZ
ZIw6k2NiRzKgMm54Fnms8ixAGtIHX9j7qGaJvGVQjc0ZxIexsrp9DgzWt6+BmRbD
H7gMmcT/pl4UzI6fSlOm9d8E/PtL3sd7pGQhEwVb4Y9U1Ihq/bHlPHrTsn0I14H3
UYZpDFKGHHH8I7r7OrBiMFSWICNsNL2c4BgRU/uzTvEivCRrnJBUjzVGtWsYscvj
HwwTxUzIMnUOe+Uc09PDmh231vKhFYIWsdFDR1MFPQfZUZ9MYPe49xxmLq0rmo4+
tqTv8vYdaMtWWbmd+G6B
=tPe/
-----END PGP SIGNATURE-----

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

Reply via email to