It's not a secret anymore!*
The moose likes Servlets and the fly likes Getting access to HttpServletResponse with in sessionDestroyed Method of HttpSessionListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting access to HttpServletResponse with in sessionDestroyed Method of HttpSessionListener" Watch "Getting access to HttpServletResponse with in sessionDestroyed Method of HttpSessionListener" New topic
Author

Getting access to HttpServletResponse with in sessionDestroyed Method of HttpSessionListener

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

Could anybody please let me know wheter this below requirement is possible ??

Is it possible to get access to HttpServletResponse reference with in sessionDestroyed method of HttpSessionListener .

Please suggest , thanks .

Save India From Corruption - Anna Hazare.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There is no HTTP request or response when a session is destroyed.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

I'd have to RTFM. But I doubt it. Under certain circumstances, such as after the timeout interval has expired, the container may decide to destroy an HttpSession even though no request/response process is in progress. In fact, timeout pretty much [b]guarantees[/i] no request/response was in progress, since a new request would have reset the timer.

And, of course, if there was no request/response, there's no response object to get hold of.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Then how do people implemented this functionality (Showing a Alert before session expires )
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Ravi Kiran Va wrote:Then how do people implemented this functionality (Showing a Alert before session expires )


They run a JavaScript timer on the client side. HTTP servers are not permitted to send unsolicited data, and that includes "timeout pending" messages.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

They run a JavaScript timer on the client side.


Could you please elobrate little bit this ??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting access to HttpServletResponse with in sessionDestroyed Method of HttpSessionListener
 
Similar Threads
session listener
Potiential Issues of Downgrading
session listener
inside the class that implements HttpSessionListener
How do you retrieve all the sessions?