org.apache.beehive.netui.pageflow.internal
Class SimpleSessionStorageHandler

Object
  extended by BaseHandler
      extended by DefaultHandler
          extended by SimpleSessionStorageHandler
All Implemented Interfaces:
Serializable, Handler, StorageHandler

public class SimpleSessionStorageHandler
extends DefaultHandler
implements StorageHandler

This storage handler simply puts/gets attributes in the session. It does not do anything to support multiple concurrent forwarded requests that are simultaneously modifying session data.

See Also:
DeferredSessionStorageHandler, Serialized Form

Constructor Summary
SimpleSessionStorageHandler(ServletContext servletContext)
           
 
Method Summary
 boolean allowBindingEvent(Object event)
          Tell whether a given binding event should be allowed to occur.
 void applyChanges(RequestContext context)
          Apply any deferred changes, at the end of a chain of requests.
 void ensureFailover(RequestContext context, String attributeName, Object value)
          Ensure that the given named attribute is replicated in a cluster for session failover, if appropriate.
 Object getAttribute(RequestContext context, String attributeName)
          Get a named attribute.
 void removeAttribute(RequestContext context, String attributeName)
          Remove a named attribute.
 void setAttribute(RequestContext context, String attributeName, Object value)
          Set a named attribute.
 
Methods inherited from class DefaultHandler
getRegisteredHandler, setRegisteredHandler
 
Methods inherited from class BaseHandler
getConfig, getPreviousHandler, getServletContext, init, reinit
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Handler
init, reinit
 

Constructor Detail

SimpleSessionStorageHandler

public SimpleSessionStorageHandler(ServletContext servletContext)
Method Detail

setAttribute

public void setAttribute(RequestContext context,
                         String attributeName,
                         Object value)
Description copied from interface: StorageHandler
Set a named attribute.

Specified by:
setAttribute in interface StorageHandler
Parameters:
context - the current RequestContext.
attributeName - the name of the attribute to set.
value - the attribute value.

removeAttribute

public void removeAttribute(RequestContext context,
                            String attributeName)
Description copied from interface: StorageHandler
Remove a named attribute.

Specified by:
removeAttribute in interface StorageHandler
Parameters:
context - the current RequestContext.
attributeName - the name of the attribute to remove.

getAttribute

public Object getAttribute(RequestContext context,
                           String attributeName)
Description copied from interface: StorageHandler
Get a named attribute.

Specified by:
getAttribute in interface StorageHandler
Parameters:
context - the current RequestContext.
attributeName - the name of the attribute to get.
Returns:
the attribute, or null if there is no such named attribute.

ensureFailover

public void ensureFailover(RequestContext context,
                           String attributeName,
                           Object value)
Description copied from interface: StorageHandler
Ensure that the given named attribute is replicated in a cluster for session failover, if appropriate.

Specified by:
ensureFailover in interface StorageHandler
Parameters:
context - the current request context.
attributeName - the name of the attribute for which failover should be ensured.
value - the value of the attribute for which failover should be ensured.

allowBindingEvent

public boolean allowBindingEvent(Object event)
Description copied from interface: StorageHandler
Tell whether a given binding event should be allowed to occur. This is mainly useful in cases when this handler writes data to some underlying storage (like the HttpSession) at some time other than when StorageHandler.setAttribute(org.apache.beehive.netui.pageflow.RequestContext, java.lang.String, java.lang.Object) is called, in which case a binding event would be misleading. Only PageFlowManagedObjects pay attention to this.

Specified by:
allowBindingEvent in interface StorageHandler
Parameters:
event - the binding event, e.g., javax.servlet.http.HttpSessionBindingEvent
Returns:
true if the event should be processed.

applyChanges

public void applyChanges(RequestContext context)
Description copied from interface: StorageHandler
Apply any deferred changes, at the end of a chain of requests.

Specified by:
applyChanges in interface StorageHandler
Parameters:
context - the current request context.