/**
   * Checks if the action received in the request is the same as the one stored in the HDIV state.
   *
   * @param request HttpServletRequest to validate
   * @param target Part of the url that represents the target action
   * @param state The restored state for this url
   * @return valid result if the actions are the same. False otherwise.
   */
  public ValidatorHelperResult isTheSameAction(
      HttpServletRequest request, String target, IState state) {

    if (state.getAction().equalsIgnoreCase(target)) {
      return ValidatorHelperResult.VALID;
    }

    if (target.endsWith("/")) {
      String actionSlash = state.getAction() + "/";
      if (actionSlash.equalsIgnoreCase(target)) {
        return ValidatorHelperResult.VALID;
      }
    }

    if (log.isDebugEnabled()) {
      log.debug("target:" + target);
      log.debug("state action:" + state.getAction());
    }

    this.logger.log(HDIVErrorCodes.ACTION_ERROR, target, null, null);

    if (log.isDebugEnabled()) {
      log.debug(
          "Detected validation error in the action: action in state:"
              + state.getAction()
              + ", action in the request:"
              + target);
    }

    return new ValidatorHelperResult(HDIVErrorCodes.ACTION_ERROR);
  }