Class RequestContext
- java.lang.Object
-
- de.hybris.platform.sap.core.extensibility.request.RequestContext
-
public class RequestContext extends java.lang.ObjectThis container can be used to pass data between layers of the SAP hybris integration framework.
NOTE:
This context MUST NOT be used in standard development. It is a tool for extending the functionality of the standard in CUSTOMER projects. The scope of the container is an request (usually one HTTP request). After the request is finished the content of the context is cleared by the framework. If you have to store data you should do it in the appropriate layer (HTTP session context, Business Object, Backend Object/Backend Context)
You can access the request context as follows:
Interaction Layer: Within an action: getRequestContext()
Business Object Layer:
Within an Business Object: getRequestContext()
Business Logic Service Layer:
Within a backend object: getBackendObjectSupport().getRequestContext()
Connection Event Listener: ConnectionEvent.getRequestContext()
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Object,java.lang.Object>mDataMap which keeps the request data.static java.lang.StringREQUEST_CONTEXTConstant can be used when storing request context in an other context.
-
Constructor Summary
Constructors Constructor Description RequestContext()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddData(java.lang.Object name, java.lang.Object value)This method stores arbitrary data within this context.java.lang.ObjectgetData(java.lang.Object name)This method retrieves data associated with name from the context.java.util.Map<java.lang.Object,java.lang.Object>getDataMap()Returns the data Map.java.util.SetgetDataValues()This method retrieves a Set of stored data.static RequestContextgetRequestContext(javax.servlet.http.HttpServletRequest request)Returns a reqest context stored as request attribute.voidremoveData(java.lang.Object name)This method removes extension data from the context.voidremoveDataValues()This method removes all extensions data from the context.voidsetDataMap(java.util.Map<java.lang.Object,java.lang.Object> dataMap)Sets the data map to the given map.
-
-
-
Field Detail
-
REQUEST_CONTEXT
public static final java.lang.String REQUEST_CONTEXT
Constant can be used when storing request context in an other context.- See Also:
- Constant Field Values
-
mData
protected java.util.Map<java.lang.Object,java.lang.Object> mData
Map which keeps the request data.
-
-
Method Detail
-
addData
public void addData(java.lang.Object name, java.lang.Object value)This method stores arbitrary data within this context.- Parameters:
name- key with which the specified value is to be associated.value- value to be associated with the specified key.
-
getData
public java.lang.Object getData(java.lang.Object name)
This method retrieves data associated with name from the context.- Parameters:
name- key with which the specified value is associated.- Returns:
- value which is associated with the specified key. If object is not found
nullis returned.
-
getDataValues
public java.util.Set getDataValues()
This method retrieves a Set of stored data.- Returns:
- set of stored data
-
removeData
public void removeData(java.lang.Object name)
This method removes extension data from the context.- Parameters:
name- key with which the specified value is associated.
-
removeDataValues
public void removeDataValues()
This method removes all extensions data from the context.
-
setDataMap
public void setDataMap(java.util.Map<java.lang.Object,java.lang.Object> dataMap)
Sets the data map to the given map.- Parameters:
dataMap- the new data Map
-
getDataMap
public java.util.Map<java.lang.Object,java.lang.Object> getDataMap()
Returns the data Map.- Returns:
- am Map containing the stored data
-
getRequestContext
public static RequestContext getRequestContext(javax.servlet.http.HttpServletRequest request)
Returns a reqest context stored as request attribute. This method is especially usefull when getting the RequestContext within a JSP- Parameters:
request- HTTP request it available in request ornull- Returns:
- the request context
-
-