Package javax.faces.context

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


    {
      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

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

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

    final String RELATIVEURL_TEST_STRING = "../resources/myImage.jpg";
    final String RELATIVEURL_VERIFY_STRING = "/resources/myImage.jpg";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    if (extCtx.encodeResourceURL(RELATIVEURL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(extCtx.getRequestContextPath() +
                                                                                                                    RELATIVEURL_VERIFY_STRING).replace("&", "&")))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a resource referenced by a relative path.");
      return Constants.TEST_SUCCESS;
View Full Code Here

      testRunner.setTestResult(false,
                               "encodeResourceURL incorrectly encoded a resource referenced by a relative path.  Expected: " +
                               ((PortletResponse) extCtx.getResponse()).encodeURL(extCtx.getRequestContextPath() +
                                                                                  RELATIVEURL_VERIFY_STRING) +
                               " and encodeResourceURL returned: " +
                               extCtx.encodeResourceURL(RELATIVEURL_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }

  // Test is SingleRequest -- Render only
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(RELATIVEURL_BACKLINK_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(verifyString).replace("&", "&")))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a relative URL with a backLink.");
      return Constants.TEST_SUCCESS;
    }
View Full Code Here

    {
      testRunner.setTestResult(false,
                               "encodeResourceURL didn't correctly encoded a relative URL with a backLink.  Expected: " +
                               verifyString +
                               " but encodeResourceURL returned: " +
                               extCtx.encodeResourceURL(RELATIVEURL_BACKLINK_TEST_STRING));
      return Constants.TEST_FAILED;
    }
  }

View Full Code Here

    final String URL_TEST_STRING = "/resources/myImage.jpg";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    if (extCtx.encodeResourceURL(URL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(extCtx.getRequestContextPath() +
                                                                                                            URL_TEST_STRING).replace("&", "&")))
    {
      testRunner.setTestResult(true,
                               "encodeResourceURL correctly encoded a resource referenced by a context path relative path.");
      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.