Package org.hdiv.dataComposer

Examples of org.hdiv.dataComposer.IDataComposer


          // Do nothing
          return;
        }

        IDataComposer dataComposer = HDIVUtil.getDataComposer(request);
        dataComposer.beginRequest("GET", urlData.getUrlWithoutContextPath());

        String processedParams = dataComposer.composeParams(urlData.getUrlParams(), "GET", Constants.ENCODING_UTF_8);
        urlData.setUrlParams(processedParams);

        String stateParam = dataComposer.endRequest();

        String hdivParameter = (String) externalContext.getSessionMap().get(Constants.HDIV_PARAMETER);

        // Add a children UIParam component with HDIV state
        UIParameter paramComponent = (UIParameter) context.getApplication().createComponent(
View Full Code Here


   *             If the attributes passed to the tag are incorrect, an exception will be thrown.
   */
  @Override
  public int doStartTag() throws JspException {

    IDataComposer dataComposer = (IDataComposer) this.pageContext.getRequest().getAttribute(
        HDIVUtil.DATACOMPOSER_REQUEST_KEY);

    String action = (String) this.getValue("action");
    String parameter = (String) this.getValue("parameter");
    String value = (String) this.getValue("value");
    String var = (String) this.getValue("var");

    String cipheredValue;
    if (action != null) {
      cipheredValue = dataComposer.compose(action, parameter, value, false);
    } else {
      cipheredValue = dataComposer.compose(parameter, value, false);
    }

    try {
      // getJspWriter to output content
      if (var != null) {
View Full Code Here

  }

  @Override
  public int doStartTag() throws JspException {

    IDataComposer dataComposer = (IDataComposer) this.pageContext.getRequest().getAttribute(
        HDIVUtil.DATACOMPOSER_REQUEST_KEY);

    String scope = (String) this.getValue("scope");
    if (scope == null) {
      // Default scope
      scope = StateScopeType.USER_SESSION.getName();
    }

    dataComposer.startScope(scope);

    return EVAL_BODY_INCLUDE;
  }
View Full Code Here

  }

  @Override
  public int doEndTag() throws JspException {

    IDataComposer dataComposer = (IDataComposer) this.pageContext.getRequest().getAttribute(
        HDIVUtil.DATACOMPOSER_REQUEST_KEY);

    dataComposer.endScope();

    return EVAL_PAGE;
  }
View Full Code Here

   *            HttpServletRequest
   * @return {@link IDataComposer} instance
   */
  public static IDataComposer getDataComposer(HttpServletRequest request) {

    IDataComposer requestDataComposer = (IDataComposer) request.getAttribute(DATACOMPOSER_REQUEST_KEY);
    return requestDataComposer;
  }
View Full Code Here

   * @return {@link IDataComposer} instance
   */
  public static IDataComposer getDataComposer() {

    HttpServletRequest request = getHttpServletRequest();
    IDataComposer newDataComposer = getDataComposer(request);
    return newDataComposer;
  }
View Full Code Here

   *            HttpServletRequest
   * @return boolean
   */
  public static boolean isDataComposer(HttpServletRequest request) {

    IDataComposer requestDataComposer = (IDataComposer) request.getAttribute(DATACOMPOSER_REQUEST_KEY);
    return requestDataComposer != null;
  }
View Full Code Here

    if (method == null) {
      method = "POST";
    }

    IDataComposer dataComposer = HDIVUtil.getDataComposer(request);
    if (dataComposer == null) {
      // IDataComposer not initialized on request, request is out of filter
      if (log.isDebugEnabled()) {
        log.debug("IDataComposer not initialized on request, request is out of filter");
      }
      return url;
    }

    UrlData urlData = this.createUrlData(url, method, request);
    if (this.isHdivStateNecessary(urlData)) {
      // the url needs protection
      String stateId = dataComposer.beginRequest(method, urlData.getUrlWithoutContextPath());

      // Publish the state in request to make it accessible on jsp
      request.setAttribute(FORM_STATE_ID, stateId);

      // Process url params
      String processedParams = dataComposer.composeParams(urlData.getUrlParams(), method,
          Constants.ENCODING_UTF_8);
      urlData.setUrlParams(processedParams);

      // Action url with confidential values
      url = this.getProcessedUrl(urlData);
View Full Code Here

   *            char encoding
   * @return processed url
   */
  public String processUrl(HttpServletRequest request, String url, String encoding) {

    IDataComposer dataComposer = HDIVUtil.getDataComposer(request);
    if (dataComposer == null) {
      // IDataComposer not initialized on request, request is out of filter
      if (log.isDebugEnabled()) {
        log.debug("IDataComposer not initialized on request, request is out of filter");
      }
      return url;
    }

    UrlData urlData = this.createUrlData(url, "GET", request);
    if (this.isHdivStateNecessary(urlData)) {
      // the url needs protection
      dataComposer.beginRequest("GET", urlData.getUrlWithoutContextPath());

      String processedParams = dataComposer.composeParams(urlData.getUrlParams(), "GET", encoding);
      urlData.setUrlParams(processedParams);

      // Hdiv state param value
      String stateParam = dataComposer.endRequest();
      // Url with confidential values and hdiv state param
      url = this.getProcessedUrlWithHdivState(request, urlData, stateParam);
    }

    return url;
View Full Code Here

  }

  public void testProcessActionComplete() {

    HttpServletRequest request = HDIVUtil.getHttpServletRequest();
    IDataComposer dataComposer = this.dataComposerFactory.newInstance(request);
    HDIVUtil.setDataComposer(dataComposer, request);
    dataComposer.startPage();

    String action = "/testAction.do";

    String result = this.formUrlProcessor.processUrl(request, action);

    // Post urls are not modified
    assertEquals(action, result);

    String val = dataComposer.compose("param", "value", false);
    assertEquals("0", val);

    String requestId = dataComposer.endRequest();

    assertNotNull(requestId);
    assertTrue(requestId.length() > 0);
  }
View Full Code Here

TOP

Related Classes of org.hdiv.dataComposer.IDataComposer

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.