6.3.4. OnDoubleSubmission Interceptor

Interceptor that performs double submission (same request sent twice) check.

To use this interceptor, Token configuration using form tag in jsp or Token configuration using UseToken interceptor are necessary.

6.3.4.2. Module list

<dependency>
  <groupId>com.nablarch.framework</groupId>
  <artifactId>nablarch-fw-web-tag</artifactId>
</dependency>

6.3.4.3. Using OnDoubleSubmission

Configure the OnDoubleSubmission annotation for the action method.

// Specify the transition destination in the path attribute when it is determined as double submission.
@OnDoubleSubmission(path = "/WEB-INF/view/error/userError.jsp")
public HttpResponse register(HttpRequest req, ExecutionContext ctx) {
    // Omitted.
}

6.3.4.4. Specify the default value of OnDoubleSubmission

To configure the default value of the OnDoubleSubmission annotation that is used throughout the application, add BasicDoubleSubmissionHandler to the component definition with the name doubleSubmissionHandler.

If the annotation attribute is not specified in BasicDoubleSubmissionHandler, then the resource path, message ID and status code configured in the own property are used.

Configuration example
<component name="doubleSubmissionHandler"
           class="nablarch.common.web.token.BasicDoubleSubmissionHandler">
  <!-- Resource path of the transition destination when double submission is determined -->
  <property name="path" value="/WEB-INF/view/error/userError.jsp" />
  <!-- Message ID used for the error message displayed on the transition destination screen when double submission is determined -->
  <property name="messageId" value="DOUBLE_SUBMISSION_ERROR" />
  <!-- Response status when double submission is determined.Default is 400 -->
  <property name="statusCode" value="200" />
</component>

Important

If both OnDoubleSubmission and BasicDoubleSubmissionHandler do not specify the path, a system error occurs because the transition destination is not known when a double submission is determined.

One of the paths must be specified in the application that uses Prevention of double submission using token.

6.3.4.5. Change the behavior of OnDoubleSubmission

The behavior of the OnDoubleSubmission annotation can be changed by implementing the interface DoubleSubmissionHandler. Add the implemented class to the component definition with the name doubleSubmissionHandler.