org.sakaiproject.entitybroker.util.request
Class RequestStorageImpl

java.lang.Object
  extended by org.sakaiproject.entitybroker.util.request.RequestStorageImpl
All Implemented Interfaces:
RequestStorage, RequestStorageWrite

public class RequestStorageImpl
extends Object
implements RequestStorageWrite

Impl for the request store, will store values in the request itself and will maintain a map of all request values in a threadlocal which should always be cleared at the end of the request

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Nested Class Summary
static class RequestStorageImpl.EntryComparator
           
 
Nested classes/interfaces inherited from interface org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
RequestStorage.RequestOrigin, RequestStorage.ReservedKeys
 
Constructor Summary
protected RequestStorageImpl()
           
  RequestStorageImpl(RequestGetter requestGetter)
           
 
Method Summary
protected  Map<String,Object> getAllRequestValues()
           
protected  HashMap<String,Object> getInternalMap()
           
protected  Object getRequestValue(String key)
           
protected  Map<String,Object> getRequestValues(boolean includeHeaders, boolean includeParams, boolean includeAttributes)
           
static Map<String,Object> getRequestValues(javax.servlet.http.HttpServletRequest request, boolean includeHeaders, boolean includeParams, boolean includeAttributes)
           
 Map<String,Object> getStorageMapCopy()
           
 Map<String,Object> getStorageMapCopy(boolean includeInternal, boolean includeHeaders, boolean includeParams, boolean includeAttributes)
          Special version which allows getting only the parts that are desired
 Object getStoredValue(String key)
           
<T> T
getStoredValueAsType(Class<T> type, String key)
           
 boolean inRequest()
           
 void reset()
          Resets the request storage and purges all stored values (has no effect on the data in the request)
 void setRequestGetter(RequestGetter requestGetter)
           
 void setRequestValue(String key, Object value)
          Allows user to set the value of a key directly, including reserved keys
 void setRequestValues(Map<String,Object> params)
          Place all these params into the request storage
 void setStoredValue(String key, Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestStorageImpl

protected RequestStorageImpl()

RequestStorageImpl

public RequestStorageImpl(RequestGetter requestGetter)
Method Detail

getInternalMap

protected HashMap<String,Object> getInternalMap()

setRequestGetter

public void setRequestGetter(RequestGetter requestGetter)

inRequest

public boolean inRequest()

getStorageMapCopy

public Map<String,Object> getStorageMapCopy()
Specified by:
getStorageMapCopy in interface RequestStorage

getStoredValue

public Object getStoredValue(String key)
Specified by:
getStoredValue in interface RequestStorage

getStorageMapCopy

public Map<String,Object> getStorageMapCopy(boolean includeInternal,
                                            boolean includeHeaders,
                                            boolean includeParams,
                                            boolean includeAttributes)
Special version which allows getting only the parts that are desired

Specified by:
getStorageMapCopy in interface RequestStorage
Parameters:
includeInternal - include the internal request values
includeHeaders - include the request headers
includeParams - include the request parameters
includeAttributes - include the request attributes
Returns:
the map with the requested values

getStoredValueAsType

public <T> T getStoredValueAsType(Class<T> type,
                                  String key)
Specified by:
getStoredValueAsType in interface RequestStorage

setStoredValue

public void setStoredValue(String key,
                           Object value)
Specified by:
setStoredValue in interface RequestStorageWrite

reset

public void reset()
Resets the request storage and purges all stored values (has no effect on the data in the request)

Specified by:
reset in interface RequestStorageWrite

setRequestValue

public void setRequestValue(String key,
                            Object value)
Allows user to set the value of a key directly, including reserved keys

Specified by:
setRequestValue in interface RequestStorageWrite
Parameters:
key -
value -

setRequestValues

public void setRequestValues(Map<String,Object> params)
Place all these params into the request storage

Specified by:
setRequestValues in interface RequestStorageWrite
Parameters:
params - map of string -> value

getRequestValue

protected Object getRequestValue(String key)

getAllRequestValues

protected Map<String,Object> getAllRequestValues()

getRequestValues

protected Map<String,Object> getRequestValues(boolean includeHeaders,
                                              boolean includeParams,
                                              boolean includeAttributes)

toString

public String toString()
Overrides:
toString in class Object

getRequestValues

public static Map<String,Object> getRequestValues(javax.servlet.http.HttpServletRequest request,
                                                  boolean includeHeaders,
                                                  boolean includeParams,
                                                  boolean includeAttributes)


Copyright © 2007-2013 CARET, University of Cambridge. All Rights Reserved.