Annotation Interface TransactionTokenCheck


@Documented @Target({METHOD,TYPE}) @Retention(RUNTIME) public @interface TransactionTokenCheck
A custom annotation that provides a functionality to perform a token check for preventing consecutive form submissions.

This token is called Transaction Token since it provides the functionality to define a transaction over calls to multiple handlerMethods in a controller within a single session. All the requests to these handlerMethods will be checked for a valid token before the method is executed.

In order to specify the start and end of token check transaction, type= TransactionTokenType.BEGIN) and type= TransactionTokenType.END) can be used respectively. If no type is specified, by default the value of type attribute is set to indicate that, calls to corresponding handler method are inside a token check transaction. (by default, type= TransactionTokenType.IN)

The structure of transaction token is tokenName~tokenKey~tokenValue. By default, the delimiter used to separate the name, key and value components of the token is ~ (tilde).

TransactionTokenCheck can be applied at class level as well as method level. class level annotation defines a common namespace at controller level. At method level, value attribute of @TransactionTokenCheck annotation can be used to give a name to the transaction. This along with the namespace at class level for the tokenName part of the token string. Giving same values as @RequestMapping tag at controller level and method level is recommended

By default, number of retries to create a key for an tokenName is 10. Once all the tries are completed, it follows FIFO algorithm to replace old keys will new ones. This default value can be changed by through settings in applicationContext file. Please refer to guideline for details regarding the configuration and usage method.

By default, if no namespace is defined and value attribute at method level is also not specified, "globalToken" is used as tokenName for all the transaction tokens generated.

  • 要素の詳細

    • value

      @AliasFor("namespace") String value
      戻り値:
      The value of generated TransactionToken
      デフォルト:
      ""
    • namespace

      @AliasFor("value") String namespace
      戻り値:
      The namespace of generated TransactionToken
      デフォルト:
      ""
    • type

      戻り値:
      Type of the TransactionToken. Default value is TransactionTokenType.IN
      デフォルト:
      IN