Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.util
Class TokenHelper

    java.lang.Object
      org.apache.struts2.util.TokenHelper

    public class TokenHelper

extends java.lang.Object

TokenHelper

Field Summary
`static java.lang.String` | `DEFAULT_TOKEN_NAME` The default name to map the token value
`static java.lang.String` | `TOKEN_NAME_FIELD` The name of the field which will hold the token name

Constructor Summary
`TokenHelper()`

Method Summary
`static java.lang.String` | `generateGUID()`
`static java.lang.String` | `getToken()` Gets a transaction token into the session using the default token name.
`static java.lang.String` | `getToken(java.lang.String tokenName)` Gets the Token value from the params in the ServletActionContext using the given name
`static java.lang.String` | `getTokenName()` Gets the token name from the Parameters in the ServletActionContext
`static java.lang.String` | `setToken()` Sets a transaction token into the session using the default token name.
`static java.lang.String` | `setToken(java.lang.String tokenName)` Sets a transaction token into the session using the provided token name.
`static boolean` | `validToken()` Checks for a valid transaction token in the current request params.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_TOKEN_NAME

    public static final java.lang.String DEFAULT_TOKEN_NAME

  The default name to map the token value

  See Also:
    Constant Field Values

### TOKEN_NAME_FIELD

    public static final java.lang.String TOKEN_NAME_FIELD

  The name of the field which will hold the token name

  See Also:
    Constant Field Values

Constructor Detail

### TokenHelper

    public TokenHelper()

Method Detail

### setToken

    public static java.lang.String setToken()

  Sets a transaction token into the session using the default token name.

  Returns:
    the token string

### setToken

    public static java.lang.String setToken(java.lang.String tokenName)

  Sets a transaction token into the session using the provided token name.

  Parameters:
    `tokenName` - the name to store into the session with the token as the value
  Returns:
    the token string

### getToken

    public static java.lang.String getToken()

  Gets a transaction token into the session using the default token name.

  Returns:
    token

### getToken

    public static java.lang.String getToken(java.lang.String tokenName)

  Gets 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

### getTokenName

    public static java.lang.String getTokenName()

  Gets 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

### validToken

    public 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

    public static java.lang.String generateGUID()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.