Package org.apache.myfaces.portlet.faces.application

Examples of org.apache.myfaces.portlet.faces.application.PortletViewHandlerResourceResponseWrapper


      // save the original response
      MimeResponse originalResponse = (MimeResponse) extContext.getResponse();

      // replace the response with our wrapper
      //TODO:  need a separate response wrapper for resources
      PortletViewHandlerResourceResponseWrapper resourceResponseWrapper = null;
      PortletViewHandlerRenderResponseWrapper renderResponseWrapper = null;
      PortletResponseWrapper wrapped = null;
      if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE)
      {
        resourceResponseWrapper = new PortletViewHandlerResourceResponseWrapper((ResourceResponse)originalResponse/*, context.getViewRoot().getLocale()*/);
        wrapped =  resourceResponseWrapper;
      }
      else
      {
        renderResponseWrapper = new PortletViewHandlerRenderResponseWrapper((RenderResponse) originalResponse/*, context.getViewRoot().getLocale()*/);
        wrapped = renderResponseWrapper;
      }
     
      if (!(wrapped instanceof PortletResponseWrapper))
        throw new IOException();
     
      extContext.setResponse(wrapped);
     
      // set request attribute indicating we can deal with content
      // that is supposed to be delayed until after JSF tree is ouput.
      extContext.getRequestMap().put(Bridge.RENDER_CONTENT_AFTER_VIEW, Boolean.TRUE);


      // build the view by executing the page
      extContext.dispatch(viewURI);

      // replace the original response
      extContext.setResponse(originalResponse);

      // Check to see if the portlet 1.0 bridge filter already put the content
      // into the attribute

      if (extContext.getRequestMap().get(Bridge.AFTER_VIEW_CONTENT) == null)
      {
        // Put the AFTER_VIEW_CONTENT into request scope
        // temporarily   
        Object o = null;
        if (renderResponseWrapper != null)
        {
         o = (renderResponseWrapper.isChars()) ? (Object) renderResponseWrapper.getChars() : (Object) renderResponseWrapper.getBytes();
        }
        else if (resourceResponseWrapper != null)
        {
          o = (resourceResponseWrapper.isChars()) ? (Object) resourceResponseWrapper.getChars() : (Object) resourceResponseWrapper.getBytes()
        }
        if (o != null)
        {
          extContext.getRequestMap().put(Bridge.AFTER_VIEW_CONTENT, o);
        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.portlet.faces.application.PortletViewHandlerResourceResponseWrapper

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.