Package org.hdiv.exception

Examples of org.hdiv.exception.HDIVException


   */
  public Key getCipherKey() {

    Key key = (Key) getHttpSession().getAttribute(this.keyName);
    if (key == null) {
      throw new HDIVException("Key not initialized on session");
    }
    return key;
  }
View Full Code Here


    } else if (this.isHashStrategy()) {
      restoredState = this.restoreHashState(requestState);
    }

    if (restoredState == null) {
      throw new HDIVException(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE);
    }
    return restoredState;
  }
View Full Code Here

    // Extract pageId and stateId from the state identifier
    int firstSeparator = requestState.indexOf("-");
    int lastSeparator = requestState.lastIndexOf("-");
    if (firstSeparator == -1 || lastSeparator == -1) {
      throw new HDIVException(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE);
    }

    String pageId;
    String sId;
    try {
      pageId = requestState.substring(0, firstSeparator);
      sId = requestState.substring(firstSeparator + 1, lastSeparator);
    } catch (StringIndexOutOfBoundsException e) {
      throw new HDIVException(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE, e);
    }

    int stateId;
    try {
      stateId = Integer.parseInt(sId);
    } catch (NumberFormatException e) {
      throw new HDIVException(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE, e);
    }

    // Obtain Scopes
    StateScope stateScope = this.stateScopeManager.getStateScope(requestState);
View Full Code Here

  protected IState getStateFromSession(String pageId, int stateId) {

    IState sessionState = this.session.getState(pageId, stateId);

    if (sessionState == null) {
      throw new HDIVException(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE);
    }
    return sessionState;
  }
View Full Code Here

   */
  protected String decodeUrl(String url) {
    try {
      return URLDecoder.decode(url, Constants.ENCODING_UTF_8);
    } catch (UnsupportedEncodingException e) {
      throw new HDIVException("Error decoding url", e);
    } catch (IllegalArgumentException e) {
      throw new HDIVException("Error decoding url", e);
    }
  }
View Full Code Here

      ValidatorHelperResult result = this.validateParameterValues(request, target, stateParameter,
          actionParamValues, parameter, values);
      return result;
    } catch (HDIVException e) {
      String errorMessage = HDIVUtil.getMessage("validation.error", e.getMessage());
      throw new HDIVException(errorMessage, e);
    }
  }
View Full Code Here

      String sId = value.substring(firstSeparator + 1, lastSeparator);
      int stateId = 0;
      try {
        stateId = Integer.parseInt(sId);
      } catch (NumberFormatException e) {
        throw new HDIVException(HDIVErrorCodes.PAGE_ID_INCORRECT);
      }

      StateScope stateScope = this.stateScopeManager.getStateScope(value);
      if (stateScope != null) {

        String token = stateScope.getStateToken(stateId);
        return requestSuffix.equals(token);
      }

      IPage currentPage = session.getPage(pageId);

      if (currentPage == null) {
        if (log.isErrorEnabled()) {
          log.error("Page with id [" + pageId + "] not found in session.");
        }
        throw new HDIVException(HDIVErrorCodes.PAGE_ID_INCORRECT);
      }

      return currentPage.getRandomToken(restoredState.getMethod()).equals(requestSuffix);

    } catch (IndexOutOfBoundsException e) {
      String errorMessage = HDIVUtil.getMessage("validation.error", e.getMessage());
      if (log.isErrorEnabled()) {
        log.error(errorMessage);
      }
      throw new HDIVException(errorMessage, e);
    }
  }
View Full Code Here

      return this.validateReceivedValuesInState(request, target, stateParameter, actionParamValues, parameter,
          values);

    } catch (HDIVException e) {
      String errorMessage = HDIVUtil.getMessage("validation.error", e.getMessage());
      throw new HDIVException(errorMessage, e);
    }
  }
View Full Code Here

    if (wrapper != null) {
      wrapper.addParameter(name, value);
    } else {
      String errorMessage = HDIVUtil.getMessage("helper.notwrapper");
      throw new HDIVException(errorMessage);
    }

  }
View Full Code Here

      String requestUri = request.getRequestURI();
      requestUri = HDIVUtil.stripSession(requestUri);
      return requestUri;
    } catch (Exception e) {
      String errorMessage = HDIVUtil.getMessage("helper.actionName");
      throw new HDIVException(errorMessage, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.hdiv.exception.HDIVException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.