Package org.apache.struts2.util
Class TokenHelper
java.lang.Object
org.apache.struts2.util.TokenHelper
TokenHelper
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringbuildTokenSessionAttributeName(String tokenName) Build a name-spaced token session attribute name based on the given token name.static Stringstatic StringgetToken()Gets a transaction token from the params in the ServletActionContext using the default token name.static StringGets the Token value from the params in the ServletActionContext using the given namestatic StringGets the token name from the Parameters in the ServletActionContextstatic voidsetSessionToken(String tokenName, String token) Put a given named token into the session map.static StringsetToken()Sets a transaction token into the session using the default token name.static StringSets a transaction token into the session based on the provided token name.static booleanChecks for a valid transaction token in the current request params.
- 
Field Details- 
TOKEN_NAMESPACEThe default namespace for storing token session values- See Also:
 
- 
DEFAULT_TOKEN_NAMEThe default name to map the token value- See Also:
 
- 
TOKEN_NAME_FIELDThe name of the field which will hold the token name- See Also:
 
 
- 
- 
Constructor Details- 
TokenHelperpublic TokenHelper()
 
- 
- 
Method Details- 
setTokenSets a transaction token into the session using the default token name.- Returns:
- the token string
 
- 
setTokenSets a transaction token into the session based on the provided token name.- Parameters:
- tokenName- the token name based on which a generated token value is stored into session; for actual session store, this name will be prefixed by a namespace.
- Returns:
- the token string
 
- 
setSessionTokenPut a given named token into the session map. The token will be stored with a namespace prefix prepended.- Parameters:
- tokenName- the token name based on which given token value is stored into session; for actual session store, this name will be prefixed by a namespace.
- token- the token value to store
 
- 
buildTokenSessionAttributeNameBuild a name-spaced token session attribute name based on the given token name.- Parameters:
- tokenName- the token name to prefix
- Returns:
- the name space prefixed session token name
 
- 
getTokenGets a transaction token from the params in the ServletActionContext using the default token name.- Returns:
- token
 
- 
getTokenGets the Token value from the params in the ServletActionContext using the given name- Parameters:
- tokenName- the name of the parameter which holds the token value
- Returns:
- the token String or null, if the token could not be found
 
- 
getTokenNameGets the token name from the Parameters in the ServletActionContext- Returns:
- the token name found in the params, or null if it could not be found
 
- 
validTokenpublic static boolean validToken()Checks for a valid transaction token in the current request params. If a valid token is found, it is removed so the it is not valid again.- Returns:
- false if there was no token set into the params (check by looking for TOKEN_NAME_FIELD), true if a valid token is found
 
- 
generateGUID
 
-