Package javax.faces.context

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


      final boolean jsfResource = component.isJsfResource();
      url = ResourceManagerUtils.getPageWithoutContextPath(facesContext, component.getResource());
      if (url != null) {
        if (jsfResource) {
          url = viewHandler.getActionURL(facesContext, url);
          url = externalContext.encodeActionURL(url);
        } else {
          url = viewHandler.getResourceURL(facesContext, url);
          url = externalContext.encodeResourceURL(url);
        }
      } else {
View Full Code Here


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

      final String link = component.getLink();
      if (link.startsWith("/")) { // internal absolute link
        url = viewHandler.getActionURL(facesContext, link);
        url = externalContext.encodeActionURL(url);
      } else if (link.contains(":")) { // external link
        url = link;
      } else { // internal relative link
        url = externalContext.encodeResourceURL(link);
      }
View Full Code Here

      "/resources/myImage.jpg?myBackLinkParam=";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    // compute what the backLink should be
    String actionURL =
      extCtx.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx,
                                                                                ctx.getViewRoot().getViewId()));
    String verifyString = null;
    try
    {
      verifyString =
View Full Code Here

      "/resources/myImage.jpg?myBackLinkParam=";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    // compute what the backLink should be
    String actionURL =
      extCtx.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx,
                                                                                ctx.getViewRoot().getViewId()));
    String verifyString = null;
    try
    {
      verifyString =
View Full Code Here

      "/tests/viewLink.jsf?param1=testValue";

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    if (extCtx.encodeResourceURL(URL_VIEWLINK_TEST_STRING).equals(extCtx.encodeActionURL(URL_VIEWLINK_VERIFY_STRING)))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a viewLink.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

    }
    else
    {
      testRunner.setTestResult(false,
                               "encodeResourceURL incorrectly encoded a viewLink.  Expected: " +
                               extCtx.encodeActionURL(URL_VIEWLINK_VERIFY_STRING) +
                               " but encodeResourceURL with the viewLink returned: " +
                               extCtx.encodeResourceURL(URL_VIEWLINK_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }
View Full Code Here

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    // compute what the backLink should be
    String actionURL =
      extCtx.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx,
                                                                                ctx.getViewRoot().getViewId()));
    String verifyString = null;
    try
    {
      verifyString =
View Full Code Here

      testRunner.setTestResult(false,
                               "Failed because couldn't UTF-8 encode backLink parameter.");
      return Constants.TEST_FAILED;
    }
    // Note:  as we are adding a URL as a parameter make sure its properly URLEncoded -- this causes it to be doubly encoded
    if (extCtx.encodeResourceURL(URL_VIEWLINK_BACKLINK_TEST_STRING).equals(extCtx.encodeActionURL(verifyString)))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a viewLink with a BackLink.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

    }
    else
    {
      testRunner.setTestResult(false,
                               "encodeResourceURL incorrectly encoded a viewLink.  Expected: " +
                               extCtx.encodeActionURL(verifyString) +
                               " but encodeResourceURL with the viewLink returned: " +
                               extCtx.encodeResourceURL(URL_VIEWLINK_BACKLINK_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }
View Full Code Here

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    // test encodeActionURL preserves the xml escape encoding in the url it returns
    if (isStrictXhtmlEncoded(extCtx.encodeActionURL("/tests/SingleRequestTest.jsp?parm1=a&param2=b")))
    {
      testRunner.setTestResult(false,
                               "EncodeActionURL incorrectly returned an url including xml escaping when the input url wasn't escaped.");
      return Constants.TEST_FAILED;
    }
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.