Package com.sun.faces.util
Class RequestStateManager
- java.lang.Object
-
- com.sun.faces.util.RequestStateManager
-
public class RequestStateManager extends Object
This helper class is used a central location for per-request state that is needed by Mojarra. This class leverages FacesContext.getAttributes() which as added in 2.0 instead of the request scope to prevent the unecessary triggering of ServletRequestAttributeListeners.
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTUAL_VIEW_MAPThis attribute is used by the StateMangaer during restore view.static StringAFTER_VIEW_CONTENTAttribute for storing any content within a page that is defined after the closing f:view.static StringDISABLED_VALIDATORSUsed to communicate which validators have been disabled for a particular nesting level within a view.static StringEL_RESOLVER_CHAIN_TYPE_NAMEAttribute describing the current ELResolver chain typestatic StringFACELET_FACTORYUsed to store the FaceletFactory as other components may need to use it during their processing.static StringFACES_VIEW_STATELeveraged by the RequestStateManager to allow deprecated ResponseStateManager methods to continue to work if called.static StringINVOCATION_PATHAttribute to store theFacesServletpath of the original request.static StringLOGICAL_VIEW_MAPThis attribute is used by the StateMangaer during restore view.static StringPROCESSED_RADIO_BUTTON_GROUPSUsed to store the Set of ResourceDependency annotations that have been processed.static StringPROCESSED_RESOURCE_DEPENDENCIESUsed to store the Set of ResourceDependency annotations that have been processed.static StringREENTRANT_GUARDThis attribute protects against infinite loops on expressions that touch a custom legacy VariableResolver that delegates to its parent VariableResolver.static StringRENDER_KIT_IMPL_REQAttribute defining theRenderKitbeing used for this request.static StringRENDERED_RESOURCE_DEPENDENCIESUsed to store the Set of resource dependencies that have been rendered.static StringRESOURCE_REQUESTLeveraged by ResourceHandlerImpl to denote whether or not a request is a resource request.static StringSCRIPT_STATEUsed to indicate whether or not Faces script has already been installed.static StringTARGET_COMPONENT_ATTRIBUTE_NAMEAttribute indicating the current component being processed.static StringVIEWTAG_STACK_ATTR_NAMEThis attribute is used by the loadBundle tag for tracking views/subviews within the logical view (this is only used when 1.1 compatibility is enabled).
-
Constructor Summary
Constructors Constructor Description RequestStateManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearAttributesOnChangeOfView(FacesContext ctx)Remove all request state attributes associated that need to be cleared on change of view.static booleancontainsKey(FacesContext ctx, String key)static <T> Tget(FacesContext ctx, String key)static Map<String,Object>getStateMap(FacesContext ctx)static Objectremove(FacesContext ctx, String key)Remove the value associated with the specified key.static voidset(FacesContext ctx, String key, Object value)Adds the specified key and value to the Map stored in the request.
-
-
-
Field Detail
-
AFTER_VIEW_CONTENT
public static final String AFTER_VIEW_CONTENT
Attribute for storing any content within a page that is defined after the closing f:view.- See Also:
- Constant Field Values
-
EL_RESOLVER_CHAIN_TYPE_NAME
public static final String EL_RESOLVER_CHAIN_TYPE_NAME
Attribute describing the current ELResolver chain type- See Also:
- Constant Field Values
-
TARGET_COMPONENT_ATTRIBUTE_NAME
public static final String TARGET_COMPONENT_ATTRIBUTE_NAME
Attribute indicating the current component being processed. This will be used when generating bytecode for custom converters.- See Also:
- Constant Field Values
-
RENDER_KIT_IMPL_REQ
public static final String RENDER_KIT_IMPL_REQ
Attribute defining theRenderKitbeing used for this request.- See Also:
- Constant Field Values
-
LOGICAL_VIEW_MAP
public static final String LOGICAL_VIEW_MAP
This attribute is used by the StateMangaer during restore view. The values are stored in the request for later use.- See Also:
- Constant Field Values
-
ACTUAL_VIEW_MAP
public static final String ACTUAL_VIEW_MAP
This attribute is used by the StateMangaer during restore view. The values are stored in the request for later use.- See Also:
- Constant Field Values
-
VIEWTAG_STACK_ATTR_NAME
public static final String VIEWTAG_STACK_ATTR_NAME
This attribute is used by the loadBundle tag for tracking views/subviews within the logical view (this is only used when 1.1 compatibility is enabled).- See Also:
- Constant Field Values
-
INVOCATION_PATH
public static final String INVOCATION_PATH
Attribute to store theFacesServletpath of the original request.- See Also:
- Constant Field Values
-
REENTRANT_GUARD
public static final String REENTRANT_GUARD
This attribute protects against infinite loops on expressions that touch a custom legacy VariableResolver that delegates to its parent VariableResolver.- See Also:
- Constant Field Values
-
FACES_VIEW_STATE
public static final String FACES_VIEW_STATE
Leveraged by the RequestStateManager to allow deprecated ResponseStateManager methods to continue to work if called.- See Also:
- Constant Field Values
-
RESOURCE_REQUEST
public static final String RESOURCE_REQUEST
Leveraged by ResourceHandlerImpl to denote whether or not a request is a resource request. ABooleanvalue will be assoicated with this key.- See Also:
- Constant Field Values
-
FACELET_FACTORY
public static final String FACELET_FACTORY
Used to store the FaceletFactory as other components may need to use it during their processing.- See Also:
- Constant Field Values
-
SCRIPT_STATE
public static final String SCRIPT_STATE
Used to indicate whether or not Faces script has already been installed.- See Also:
- Constant Field Values
-
DISABLED_VALIDATORS
public static final String DISABLED_VALIDATORS
Used to communicate which validators have been disabled for a particular nesting level within a view.- See Also:
- Constant Field Values
-
PROCESSED_RESOURCE_DEPENDENCIES
public static final String PROCESSED_RESOURCE_DEPENDENCIES
Used to store the Set of ResourceDependency annotations that have been processed.- See Also:
- Constant Field Values
-
PROCESSED_RADIO_BUTTON_GROUPS
public static final String PROCESSED_RADIO_BUTTON_GROUPS
Used to store the Set of ResourceDependency annotations that have been processed.- See Also:
- Constant Field Values
-
RENDERED_RESOURCE_DEPENDENCIES
public static final String RENDERED_RESOURCE_DEPENDENCIES
Used to store the Set of resource dependencies that have been rendered.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static <T> T get(FacesContext ctx, String key)
- Parameters:
ctx- theFacesContextfor the current requestkey- the key for the value- Returns:
- the value associated with the specified key.
-
set
public static void set(FacesContext ctx, String key, Object value)
Adds the specified key and value to the Map stored in the request. If
valueisnull, that key/value pair will be removed from the Map.- Parameters:
ctx- theFacesContextfor the current requestkey- the key for the valuevalue- the value to store
-
remove
public static Object remove(FacesContext ctx, String key)
Remove the value associated with the specified key.
- Parameters:
ctx- theFacesContextfor the current requestkey- the key for the value- Returns:
- the value previous associated with the specified key, if any
-
clearAttributesOnChangeOfView
public static void clearAttributesOnChangeOfView(FacesContext ctx)
Remove all request state attributes associated that need to be cleared on change of view.
- Parameters:
ctx- theFacesContextfor the current request
-
containsKey
public static boolean containsKey(FacesContext ctx, String key)
- Parameters:
ctx- theFacesContextfor the current requestkey- the key for the value- Returns:
- true if the specified key exists in the Map
-
getStateMap
public static Map<String,Object> getStateMap(FacesContext ctx)
- Parameters:
ctx- theFacesContextfor the current request- Returns:
- the Map from the request containing the implementation specific attributes needed for processing
-
-