Package javax.faces.context

Examples of javax.faces.context.ExternalContext.encodeResourceURL()


    testRunner.setTestComplete(true);

    final String OPAQUE_TEST_STRING = "mailto:jsr-301-comments@jcp.org";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    if (extCtx.encodeResourceURL(OPAQUE_TEST_STRING).equals(OPAQUE_TEST_STRING))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly returned an unchanged string when the input was an opaque URL.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here


    {
      testRunner.setTestResult(false,
                               "encodeResourceURL didn't return an unchanged string when the input was an opaque URL.  Test parameter: " +
                               OPAQUE_TEST_STRING +
                               " and encodeResourceURL returned: " +
                               extCtx.encodeResourceURL(OPAQUE_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }

  // Test is SingleRequest -- Render only
View Full Code Here

    testRunner.setTestComplete(true);

    final String FOREIGNEXTERNALURL_TEST_STRING = "http://www.apache.org";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    if (extCtx.encodeResourceURL(FOREIGNEXTERNALURL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(FOREIGNEXTERNALURL_TEST_STRING).replace("&", "&")))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a foreign external URL.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

    {
      testRunner.setTestResult(false,
                               "encodeResourceURL didn't correctly encoded a foreign external URL.  Expected: " +
                               ((PortletResponse) extCtx.getResponse()).encodeURL(FOREIGNEXTERNALURL_TEST_STRING) +
                               " and encodeResourceURL returned: " +
                               extCtx.encodeResourceURL(FOREIGNEXTERNALURL_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }

View Full Code Here

      return Constants.TEST_FAILED;
    }
   
    // According to bridge rules since string passed in isn't xml strict encoded the result won't be as well
    // So ensure compares match by stripping from the one generated by the portlet container (if it exists)
    if (extCtx.encodeResourceURL(FOREIGNEXTERNALURL_BACKLINK_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(verifyString).replace("&", "&")))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a foreign external URL with a backLink.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

        if (jsfResource) {
          url = viewHandler.getActionURL(facesContext, url);
          url = externalContext.encodeActionURL(url);
        } else {
          url = viewHandler.getResourceURL(facesContext, url);
          url = externalContext.encodeResourceURL(url);
        }
      } else {
        url = "";
      }
    } else if (component.getLink() != null) {
View Full Code Here

      }
    } else if (component.getLink() != null) {

      final String link = component.getLink();
      if (link.startsWith("/")) { // internal absolute link
        url = externalContext.encodeResourceURL(externalContext.getRequestContextPath() + link);
      } else if (StringUtils.isUrl(link)) { // external link
        url = link;
      } else { // internal relative link
        url = externalContext.encodeResourceURL(link);
      }
View Full Code Here

      if (link.startsWith("/")) { // internal absolute link
        url = externalContext.encodeResourceURL(externalContext.getRequestContextPath() + link);
      } else if (StringUtils.isUrl(link)) { // external link
        url = link;
      } else { // internal relative link
        url = externalContext.encodeResourceURL(link);
      }

      final StringBuilder builder = new StringBuilder(url);
      boolean firstParameter = !url.contains("?");
      for (final UIComponent child : component.getChildren()) {
View Full Code Here

        if (image != null)
        {
            // type="image"
            writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_IMAGE, JSFAttr.TYPE_ATTR);
            String src = facesContext.getApplication().getViewHandler().getResourceURL(facesContext, image);
            writer.writeURIAttribute(HTML.SRC_ATTR, externalContext.encodeResourceURL(src), JSFAttr.IMAGE_ATTR);
        }
        else
        {
            // type="button"
            writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_BUTTON, JSFAttr.TYPE_ATTR);
View Full Code Here

    testRunner.setTestComplete(true);

    final String OPAQUE_TEST_STRING = "mailto:jsr-301-comments@jcp.org";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    if (extCtx.encodeResourceURL(OPAQUE_TEST_STRING).equals(OPAQUE_TEST_STRING))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly returned an unchanged string when the input was an opaque URL.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.