SPT Core API

com.sptci.echo2.http
Class SessionListener

java.lang.Object
  extended by com.sptci.echo2.http.SessionListener
All Implemented Interfaces:
EventListener, HttpSessionListener

public abstract class SessionListener
extends Object
implements HttpSessionListener

A HttpSessionListener to close any resources that are associated with the Application instance and its sub-classes.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: SessionListener.java 4553 2008-12-24 10:34:16Z rakesh $
Author:
Rakesh Vidyadharan 2007-05-27

Field Summary
protected static String CONTAINER_INSTANCE
          The session attribute associated with ContainerInstance.
protected static Logger logger
          The logger to use to log messages to.
 
Constructor Summary
SessionListener()
           
 
Method Summary
protected abstract  void close(HttpSession session)
          Close any resources associated with the session.
 void sessionCreated(HttpSessionEvent event)
          Add the current session to the servlet context to be handled when the context is unloaded.
 void sessionDestroyed(HttpSessionEvent event)
          Close the persistence manager when the session is destroyed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINER_INSTANCE

protected static final String CONTAINER_INSTANCE
The session attribute associated with ContainerInstance. This assumes that the Servlet is configured with a name servlet in web.xml. "Echo2UserInstance:servlet"

See Also:
Constant Field Values

logger

protected static final Logger logger
The logger to use to log messages to.

Constructor Detail

SessionListener

public SessionListener()
Method Detail

sessionCreated

public void sessionCreated(HttpSessionEvent event)
Add the current session to the servlet context to be handled when the context is unloaded.

Specified by:
sessionCreated in interface HttpSessionListener
See Also:
ContextListener.add(javax.servlet.http.HttpSession, com.sptci.echo2.http.SessionListener)

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent event)
Close the persistence manager when the session is destroyed. Session is destroyed when the user logs out of the application, or closes the browser.

Specified by:
sessionDestroyed in interface HttpSessionListener
See Also:
close(javax.servlet.http.HttpSession), ContextListener.remove(javax.servlet.http.HttpSession)

close

protected abstract void close(HttpSession session)
Close any resources associated with the session. Sub-classes must over-ride this method.

Parameters:
session - The session in which the connection was established.

SPT Core API