Package org.hdiv.state

Examples of org.hdiv.state.IParameter


    if (method == null || method.length() == 0) {
      // Default method is GET
      method = "GET";
    }

    IParameter parameter = this.composeParameter(parameterName, value, editable, editableName, isActionParam,
        charEncoding);

    if (this.isConfidentialParam(parameterName, method)) {
      return parameter.getConfidentialValue();
    } else {
      return value;
    }

  }
View Full Code Here


    }

    // Get actual IState
    IState state = this.getStatesStack().peek();

    IParameter parameter = state.getParameter(parameterName);
    if (parameter != null) {
      if (parameter.isEditable() != editable) {
        // A parameter can be created as editable but if a new non editable value is added, the parameter is
        // changed to non editable. This is required in some frameworks like Struts 2.
        parameter.setEditable(editable);
      }
      parameter.addValue(decodedValue);
    } else {
      // create a new parameter and add to the request
      parameter = createParameter(parameterName, decodedValue, editable, editableDataType, isActionParam,
          charEncoding);
      state.addParameter(parameter);
View Full Code Here

   */
  public void mergeParameters(String oldParameter, String newParameter) {

    // Get actual IState
    IState state = this.getStatesStack().peek();
    IParameter storedParameter = state.getParameter(oldParameter);

    if (storedParameter.getValues().size() > 0) {

      IParameter parameter = this.composeParameter(newParameter, storedParameter.getValuePosition(0), false, "",
          false, Constants.ENCODING_UTF_8);

      String currentValue = null;
      // We check the parameters since the second position because the first
      // value has been used to create the parameter
      for (int i = 1; i < storedParameter.getValues().size(); i++) {

        currentValue = storedParameter.getValuePosition(i);
        parameter.addValue(currentValue);
      }
    }
  }
View Full Code Here

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);
View Full Code Here

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);
View Full Code Here

    IPage page = new Page();
    page.setId(20);

    IState state = new State(0);
    state.setAction("/action");
    IParameter param = new Parameter("name", "value", false, null, true);
    state.addParameter(param);
    page.addState(state);

    session.addPage("20", page);
View Full Code Here

    // 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

    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

    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

    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

TOP

Related Classes of org.hdiv.state.IParameter

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.