Package javax.portlet

Examples of javax.portlet.RenderResponse


    final String PORTLET_RENDER_TEST_STRING_XMLENCODED =
      "portlet:render?param1=value1&param2=value2";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
   
    RenderResponse response = (RenderResponse) extCtx.getResponse();
    PortletURL portletURL = response.createRenderURL();
    portletURL.setParameter("param1", "value1");
    portletURL.setParameter("param2", "value2");
    String portletEncoded = portletURL.toString();
   
    // PortletContainers can return "URLs" with strict XML encoding -- as the bridge
View Full Code Here


    final String PORTLET_ACTION_TEST_STRING_XMLENCODED =
      "portlet:action?param1=value1&param2=value2";
    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();

    RenderResponse response = (RenderResponse) extCtx.getResponse();
    PortletURL portletURL = response.createActionURL();
    portletURL.setParameter("param1", "value1");
    portletURL.setParameter("param2", "value2");
    String portletEncoded = portletURL.toString();
   
    // PortletContainers can return "URLs" with strict XML encoding -- as the bridge
View Full Code Here

  {
    testRunner.setTestComplete(true);

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    RenderResponse renderResponse = (RenderResponse) extCtx.getResponse();

    String charEncoding = extCtx.getResponseCharacterEncoding();
    String renderCharEncoding = renderResponse.getCharacterEncoding();
   
    if ((charEncoding == null && renderCharEncoding == null) || charEncoding.equals(renderCharEncoding))
    {
      testRunner.setTestResult(true,
                               "extCtx.getResponseCharacterEncoding() correctly returned the same value as renderResponse.getCharacterEncoding()");
View Full Code Here

        Mock mockResponse = mock(RenderResponse.class);
        Mock mockRd = mock(PortletRequestDispatcher.class);
        Mock mockPrep = mock(PortletRequestDispatcher.class);

        RenderRequest req = (RenderRequest)mockRequest.proxy();
        RenderResponse res = (RenderResponse)mockResponse.proxy();
        PortletRequestDispatcher rd = (PortletRequestDispatcher)mockRd.proxy();
        PortletConfig cfg = (PortletConfig)mockConfig.proxy();
        PortletContext ctx = (PortletContext)mockCtx.proxy();
        ActionInvocation inv = (ActionInvocation)mockInvocation.proxy();
View Full Code Here

        Mock mockResponse = mock(RenderResponse.class);
        Mock mockRd = mock(PortletRequestDispatcher.class);
        Mock mockPrep = mock(PortletRequestDispatcher.class);

        RenderRequest req = (RenderRequest)mockRequest.proxy();
        RenderResponse res = (RenderResponse)mockResponse.proxy();
        PortletRequestDispatcher rd = (PortletRequestDispatcher)mockRd.proxy();
        PortletConfig cfg = (PortletConfig)mockConfig.proxy();
        PortletContext ctx = (PortletContext)mockCtx.proxy();

        Constraint[] params = new Constraint[]{same(req), same(res)};
View Full Code Here

  {
    testRunner.setTestComplete(true);

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    RenderResponse renderResponse = (RenderResponse) extCtx.getResponse();
    String contentType = extCtx.getResponseContentType();
    String renderContentType = renderResponse.getContentType();
   
    if ((contentType == null && renderContentType == null) || contentType.equals(renderContentType))
    {
      testRunner.setTestResult(true,
                               "extCtx.getResponseContentType() correctly returned the same value as renderResponse.getContentType().");
View Full Code Here

  {
    testRunner.setTestComplete(true);

    FacesContext ctx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = ctx.getExternalContext();
    RenderResponse response = (RenderResponse) extCtx.getResponse();

    String encodedNamespace = extCtx.encodeNamespace("");
    if (encodedNamespace == null)
    {
      testRunner.setTestResult(false,
                               "extCtx.encodeNamespace() failed:  it returned a null value");
    }
    else if (encodedNamespace.equals(response.getNamespace()))
    {
      testRunner.setTestResult(true,
                               "extCtx.encodeNamespace() correctly returned the same value as response.encodeNamespace when encoding the empty string.");
    }
    else
    {
      testRunner.setTestResult(false,
                               "extCtx.encodeNamespace() failed:  it returned a different value than response.encodeNamespace when encoding the empty string: it returned: " +
                               encodedNamespace + " but we expected: " +
                               response.getNamespace());
    }

    if (testRunner.getTestStatus())
    {
      return Constants.TEST_SUCCESS;
View Full Code Here

                portlet.processAction(actionRequest, actionResponse);
            }
            else if (method == ContainerConstants.METHOD_RENDER)
            {
                RenderRequest renderRequest = null;
                RenderResponse renderResponse =  null;

                if (isParallelMode)
                {
                    renderRequest = (RenderRequest) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_REQUEST);
                    renderResponse = (RenderResponse) CurrentWorkerContext.getAttribute(ContainerConstants.PORTLET_RESPONSE);
View Full Code Here

    @Override
    public String getActionURL(FacesContext context, String viewId)
    {
        if (PortletUtil.isRenderResponse(context))
        {
            RenderResponse response = (RenderResponse) context.getExternalContext().getResponse();
            PortletURL url = response.createActionURL();
            url.setParameter(MyFacesGenericPortlet.VIEW_ID, viewId);
            return url.toString();
        }
        return super.getActionURL(context, viewId);
    }
View Full Code Here

   */
  protected void executeRenderResult(final String finalLocation) throws PortletException, IOException {
    LOG.debug("Executing result in Render phase");
    PortletContext ctx = PortletActionContext.getPortletContext();
    RenderRequest req = PortletActionContext.getRenderRequest();
    RenderResponse res = PortletActionContext.getRenderResponse();
    res.setContentType(contentType);
    if (TextUtils.stringSet(title)) {
      res.setTitle(title);
    }
    LOG.debug("Location: " + finalLocation);
    if (useDispatcherServlet) {
      req.setAttribute(DISPATCH_TO, finalLocation);
      PortletRequestDispatcher dispatcher = ctx.getNamedDispatcher(dispatcherServletName);
View Full Code Here

TOP

Related Classes of javax.portlet.RenderResponse

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.