Class RequestStorageImpl
- java.lang.Object
-
- org.sakaiproject.entitybroker.util.request.RequestStorageImpl
-
- All Implemented Interfaces:
org.sakaiproject.entitybroker.entityprovider.extension.RequestStorage,org.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
public class RequestStorageImpl extends Object implements org.sakaiproject.entitybroker.entityprovider.extension.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
Nested Classes Modifier and Type Class Description static classRequestStorageImpl.EntryComparator
-
Constructor Summary
Constructors Modifier Constructor Description protectedRequestStorageImpl()RequestStorageImpl(org.sakaiproject.entitybroker.entityprovider.extension.RequestGetter requestGetter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>getAllRequestValues()protected HashMap<String,Object>getInternalMap()protected ObjectgetRequestValue(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 desiredObjectgetStoredValue(String key)<T> TgetStoredValueAsType(Class<T> type, String key)booleaninRequest()voidreset()Resets the request storage and purges all stored values (has no effect on the data in the request)voidsetRequestGetter(org.sakaiproject.entitybroker.entityprovider.extension.RequestGetter requestGetter)voidsetRequestValue(String key, Object value)Allows user to set the value of a key directly, including reserved keysvoidsetRequestValues(Map<String,Object> params)Place all these params into the request storagevoidsetStoredValue(String key, Object value)StringtoString()
-
-
-
Method Detail
-
setRequestGetter
public void setRequestGetter(org.sakaiproject.entitybroker.entityprovider.extension.RequestGetter requestGetter)
-
inRequest
public boolean inRequest()
-
getStorageMapCopy
public Map<String,Object> getStorageMapCopy()
- Specified by:
getStorageMapCopyin interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
-
getStoredValue
public Object getStoredValue(String key)
- Specified by:
getStoredValuein interfaceorg.sakaiproject.entitybroker.entityprovider.extension.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:
getStorageMapCopyin interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorage- Parameters:
includeInternal- include the internal request valuesincludeHeaders- include the request headersincludeParams- include the request parametersincludeAttributes- include the request attributes- Returns:
- the map with the requested values
-
getStoredValueAsType
public <T> T getStoredValueAsType(Class<T> type, String key)
- Specified by:
getStoredValueAsTypein interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorage
-
setStoredValue
public void setStoredValue(String key, Object value)
- Specified by:
setStoredValuein interfaceorg.sakaiproject.entitybroker.entityprovider.extension.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:
resetin interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite
-
setRequestValue
public void setRequestValue(String key, Object value)
Allows user to set the value of a key directly, including reserved keys- Specified by:
setRequestValuein interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite- Parameters:
key-value-
-
setRequestValues
public void setRequestValues(Map<String,Object> params)
Place all these params into the request storage- Specified by:
setRequestValuesin interfaceorg.sakaiproject.entitybroker.entityprovider.extension.RequestStorageWrite- Parameters:
params- map of string -> value
-
getRequestValues
protected Map<String,Object> getRequestValues(boolean includeHeaders, boolean includeParams, boolean includeAttributes)
-
-