• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Killing session on closing a browser

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I need a help on how to kill a session on closing a browser.I am handling sessions using servlets in weblogic application server.
Wishes
Saravanan.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The "Session" is always per browser-window basis & if u close the browser window, then it's all over. No need to kill the session explicitly.
Can u explain what do u want to do with session?
 
Saravanan V
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Senthil
Thanx for ur reply...Here is the scenario in my case..
I implement sessionlistener interface for doing operations for setting and resetting the flag when session is created and destroyed.I need this sessionDestroyed to be called when the browser is closed which means i need to trap that event.Hope the problem is clear now..
Wishes
Saravanan.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the problem is that there is no way to know on the server-side that the browser has been closed. The only way to work around that is to set an appropriate timeout after which you close the session.
Also you might want to read the following thread which discusses the same issues.
http://www.javaranch.com/ubb/Forum50/HTML/000219.html
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
[This message has been edited by Valentin Crettaz (edited November 22, 2001).]
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can know at server side when the browser is closed, for this you have to integrate applet in those web pages , inside applet you can open printstream to servlet and in that applet's destroy method you can pass some notification to printstream to servlet. this way everytime servlet is notified if browser is closed and session ended.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ray bond:
you can know at server side when the browser is closed, for this you have to integrate applet in those web pages , inside applet you can open printstream to servlet and in that applet's destroy method you can pass some notification to printstream to servlet. this way everytime servlet is notified if browser is closed and session ended.


Since the destroy() method is called every time you change pages, how would you tell the difference between closing the browser and going to another page? I don't think this would work...
Kyle

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic