org.barracudamvc.plankton.data
Class ServletRequestParameterStateMap

java.lang.Object
  extended by org.barracudamvc.plankton.data.ServletRequestParameterStateMap
All Implemented Interfaces:
StateMap

public class ServletRequestParameterStateMap
extends Object
implements StateMap

The implementation provides a StateMap bridge to a ServletRequest object's paramter values. By this, we mean that this class allows you to access ServletRequest paramters through the StateMap interface. Unlike the ServletRequest parameters, this class will handle null keys, values. Note however, that it's read-only. Put requests are silently ignored.


Field Summary
protected  javax.servlet.ServletRequest request
           
 
Constructor Summary
ServletRequestParameterStateMap(javax.servlet.ServletRequest irequest)
          Public constructor.
 
Method Summary
 void clearState()
          clear all state information
 javax.servlet.ServletRequest getRequest()
          get a reference to the underlying ServletRequest
 Object getState(Object key)
          get a property in this StateMap.
 Set getStateKeys()
          get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation).
 Map getStateStore()
          get a Map that holds the state values (whether or not the Map is backed by the data store depends on the implementation).
 void putState(Object key, Object val)
          set a property in this StateMap - not implemented because the servlet API doesn't allow you to set parameters
 Object removeState(Object key)
          remove a property in this StateMap - not implemented because the servlet API doesn't allow you to set parameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected javax.servlet.ServletRequest request
Constructor Detail

ServletRequestParameterStateMap

public ServletRequestParameterStateMap(javax.servlet.ServletRequest irequest)
Public constructor.

Parameters:
irequest - the underlying servlet request structure
Method Detail

putState

public void putState(Object key,
                     Object val)
set a property in this StateMap - not implemented because the servlet API doesn't allow you to set parameters

Specified by:
putState in interface StateMap
Parameters:
key - the key object
val - the value object

getState

public Object getState(Object key)
get a property in this StateMap. Since the underlying structure is an HttpRequest parameter we have to handle the case where there are multiple values for a key. In this case, a List will be returned.

Specified by:
getState in interface StateMap
Parameters:
key - the key object
Returns:
the value for the given key

removeState

public Object removeState(Object key)
remove a property in this StateMap - not implemented because the servlet API doesn't allow you to set parameters

Specified by:
removeState in interface StateMap
Parameters:
key - the key object
Returns:
the object which was removed

getStateKeys

public Set getStateKeys()
get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation). In this particular case, the set is just a COPY of the underlying data structure

Specified by:
getStateKeys in interface StateMap
Returns:
a Set of keys for this StateMap

getStateStore

public Map getStateStore()
get a Map that holds the state values (whether or not the Map is backed by the data store depends on the implementation). In this particular case, the map is a COPY of the underlying data store itself (ServletRequest Parameters)

Specified by:
getStateStore in interface StateMap
Returns:
a Map of key/val pairs for this StateMap

clearState

public void clearState()
clear all state information

Specified by:
clearState in interface StateMap

getRequest

public javax.servlet.ServletRequest getRequest()
get a reference to the underlying ServletRequest

Returns:
a reference to the underlying ServletRequest


Copyright © 2006 BarracudaMVC.org All Rights Reserved.