Package org.hdiv.state

Examples of org.hdiv.state.IState


    result = this.restoreState(request, target);
    if (!result.isValid()) {
      return result;
    }
    // Get resultant object, the stored state
    IState state = (IState) result.getValue();

    result = this.isTheSameAction(request, target, state);
    if (!result.isValid()) {
      return result;
    }

    result = this.allRequiredParametersReceived(request, state, target);
    if (!result.isValid()) {
      return result;
    }

    // Hdiv parameter name
    String hdivParameter = this.getHdivParameter(request);

    // Extract url params from State
    BasicUrlData urlData = this.urlProcessor.processUrl(request, "?" + state.getParams());
    Map<String, String[]> stateParams = urlData.getUrlParams();

    Map<String, String[]> unauthorizedEditableParameters = new HashMap<String, String[]>();
    Enumeration<?> parameters = request.getParameterNames();
    while (parameters.hasMoreElements()) {

      String parameter = (String) parameters.nextElement();

      // Validate parameter
      result = this.validateParameter(request, state.getParameter(parameter), stateParams.get(parameter),
          unauthorizedEditableParameters, hdivParameter, target, parameter);
      if (!result.isValid()) {
        return result;
      }
View Full Code Here


      return new ValidatorHelperResult(HDIVErrorCodes.HDIV_PARAMETER_NOT_EXISTS);
    }

    try {

      IState state = this.stateUtil.restoreState(requestState);

      if (this.stateUtil.isMemoryStrategy(requestState)) {

        if (!this.validateHDIVSuffix(requestState, state)) {
          this.logger.log(HDIVErrorCodes.HDIV_PARAMETER_INCORRECT_VALUE, target, hdivParameter, requestState);
View Full Code Here

  }

  protected Integer existEqualState(IState state) {

    for (Entry<Integer, StateAndToken> entry : states.entrySet()) {
      IState cacheState = entry.getValue().getState();

      if (this.areEqualStates(cacheState, state)) {
        return entry.getKey();
      }
    }
View Full Code Here

    String stateId = dataComposer.endRequest();
    dataComposer.endPage();

    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());
    List<String> values = state.getParameter("parameter1").getValues();
    assertEquals(1, values.size());
    assertEquals("2", values.get(0));
  }
View Full Code Here

    String stateId = dataComposer.endRequest();
    dataComposer.endPage();

    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());
    String stateParams = state.getParams();
    assertEquals(params, stateParams);
  }
View Full Code Here

    dataComposer.endPage();

    assertTrue(memoryPattern.matcher(stateId).matches());
    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());
    List<String> values = state.getParameter("parameter1").getValues();
    assertEquals(1, values.size());
    assertEquals("2", values.get(0));
  }
View Full Code Here

    dataComposer2.compose("parameter2", "2", false);
    String state2 = dataComposer2.endRequest();
    dataComposer2.endPage();

    // Restore state
    IState state = this.stateUtil.restoreState(state2);

    // State contains both parameters
    IParameter param = state.getParameter("parameter1");
    String val = param.getValues().get(0);
    assertEquals("1", val);

    param = state.getParameter("parameter2");
    val = param.getValues().get(0);
    assertEquals("2", val);
  }
View Full Code Here

    assertNotNull(stateId);
    assertNotNull(stateIdInner);
    assertNotSame(stateId, stateIdInner);

    IState state = this.stateUtil.restoreState(stateId);
    IState stateInner = this.stateUtil.restoreState(stateIdInner);
    String action = state.getAction();
    String actionInner = stateInner.getAction();
    assertEquals("test.do", action);
    assertEquals("testinner.do", actionInner);
  }
View Full Code Here

    String stateId = dataComposer.endRequest();
    dataComposer.endPage();

    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());

    IParameter param = state.getParameter("parameter1");
    List<String> values = param.getValues();
    assertEquals(1, values.size());
    assertEquals("è-test", values.get(0));// escaped value is the same

    IParameter param2 = state.getParameter("parameterEscaped");
    List<String> values2 = param2.getValues();
    assertEquals(1, values2.size());
    // State stored value is not escaped value, it is the unescaped value
    assertEquals("è-test", values2.get(0));
  }
View Full Code Here

    String stateId = dataComposer.endRequest();
    dataComposer.endPage();

    assertNotNull(stateId);

    IState state = this.stateUtil.restoreState(stateId);

    assertEquals("test.do", state.getAction());

    IParameter param = state.getParameter("parameter1");
    List<String> values = param.getValues();
    assertEquals(0, values.size());
  }
View Full Code Here

TOP

Related Classes of org.hdiv.state.IState

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.