com.bowstreet.webapp.util
Class WebAppModelStateManager

java.lang.Object
  extended by com.bowstreet.webapp.util.WebAppModelStateManager
All Implemented Interfaces:
ModelStateManager, java.io.Serializable

public class WebAppModelStateManager
extends java.lang.Object
implements ModelStateManager

Default implementation of ModelStateManager that uses minimal model serialization, storing linked model state only.

See Also:
Serialized Form

Nested Class Summary
 class WebAppModelStateManager.LinkedModelDescriptor
          Encodes the state of a linked model slot.
static interface WebAppModelStateManager.Restorable
          Base for classes that encode and restore the state of an item.
 
Field Summary
static java.lang.String CURRENT_ID_ATTRIBUTE
           
 
Fields inherited from interface com.bowstreet.webapp.util.ModelStateManager
MODEL_STATE_MANAGER_ATTRIBUTE
 
Constructor Summary
WebAppModelStateManager()
           
 
Method Summary
static ModelStateManager getManager(WebAppAccess webAppAccess, java.lang.String mgrClassName)
          Factory method: find a model state manager with the given class, creating it if necessary.
 java.lang.String getStateID(javax.servlet.http.HttpServletRequest req)
          Analyze the current application state, and return an identifier that can be used to later reconstitute this structure.
static void handleRequest(WebAppAccess webAppAccess)
          Typical code to handle a request with an associated ModelStateManger.
 void realizeState(javax.servlet.http.HttpServletRequest req, java.lang.String stateID)
          Given a previously-computed application state ID, bring the current application state into synch with the implied structure.
static void setManager(WebAppAccess webAppAccess, ModelStateManager mgr)
          Make this ModelStateManager instance be the current manager in session.
 void setWebAppAccess(WebAppAccess webAppAccess)
          Call this to give other methods a WebAppAccess implementation to use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_ID_ATTRIBUTE

public static final java.lang.String CURRENT_ID_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

WebAppModelStateManager

public WebAppModelStateManager()
Method Detail

getManager

public static ModelStateManager getManager(WebAppAccess webAppAccess,
                                           java.lang.String mgrClassName)
Factory method: find a model state manager with the given class, creating it if necessary.


getStateID

public java.lang.String getStateID(javax.servlet.http.HttpServletRequest req)
Analyze the current application state, and return an identifier that can be used to later reconstitute this structure.

Specified by:
getStateID in interface ModelStateManager
Parameters:
req - the HttpServletRequest for this request
Returns:
a short string representing the current state - use URL-friendly characters, since that's where this will be encoded

handleRequest

public static void handleRequest(WebAppAccess webAppAccess)
Typical code to handle a request with an associated ModelStateManger.


realizeState

public void realizeState(javax.servlet.http.HttpServletRequest req,
                         java.lang.String stateID)
Given a previously-computed application state ID, bring the current application state into synch with the implied structure.

Specified by:
realizeState in interface ModelStateManager
Parameters:
req - the HttpServletRequest for this request
stateID - the state identifier for the state in question

setManager

public static void setManager(WebAppAccess webAppAccess,
                              ModelStateManager mgr)
Make this ModelStateManager instance be the current manager in session.


setWebAppAccess

public void setWebAppAccess(WebAppAccess webAppAccess)
Call this to give other methods a WebAppAccess implementation to use.

Specified by:
setWebAppAccess in interface ModelStateManager
Parameters:
webAppAccess - a valid WebAppAccess implementation


Copyright © 2009 IBM. All Rights Reserved.