Package javax.portlet.faces

Examples of javax.portlet.faces.BridgeWriteBehindResponse


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

      // see whether the portlet wants to use a writeBehindResponse(Wrapper)
      Class<? extends BridgeWriteBehindResponse> writeBehindResponseWrapperClass = (Class<? extends BridgeWriteBehindResponse>) extContext.getRequestMap().get(BridgeImpl.WRITE_BEHIND_RESPONSE);
      BridgeWriteBehindResponse wrapped = null;
      if (writeBehindResponseWrapperClass != null)
      {
        try
       
          wrapped = writeBehindResponseWrapperClass.newInstance();
          if ((BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE && wrapped instanceof RenderResponse) ||
              (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RESOURCE_PHASE && wrapped instanceof ResourceResponse))                                                                                                                     
          {

            extContext.setResponse(wrapped);
          }
          else
          {
            // warn and don't use
            wrapped = null;
            extContext.log("Unable to use configured BridgeWriteBehindResponse instance because its not the appropriate PortletResponseWrapper for the associated phase.");
          }
         
        } catch (Exception e)
        {
          // Just warn and don't use;
          extContext.log("Unable to instantiate configured BridgeWriteBehindResponse instance: ", e);
        }
      }
      else
      {
        // Use the generic (non-writeBehindResponse) wrapper
        if (BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE)
        {
          wrapped = new BridgeViewHandlerRenderResponseWrapper();
        }
        else
        {
          wrapped = new BridgeViewHandlerResourceResponseWrapper();
        }
        extContext.setResponse(wrapped);
        // don't set write behind as this one doesn't support the Faces specific implementation dependent interfaces
      }
      // 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);

      if (wrapped != null)
      {
        // replace the original response
        extContext.setResponse(originalResponse);
       
        // Check whether our wrapper participated in the the writeBehind mechanism and/or
        // something else already did (servlet filter)
        if (wrapped.hasFacesWriteBehindMarkup() && extContext.getRequestMap().get(Bridge.AFTER_VIEW_CONTENT) == null)
        {
          // Put the AFTER_VIEW_CONTENT into request scope
          // temporarily   
          Object o = (wrapped.isChars()) ? (Object) wrapped.getChars() : (Object) wrapped.getBytes();
       
          if (o != null)
          {
            extContext.getRequestMap().put(Bridge.AFTER_VIEW_CONTENT, o);
          }
        }
        else
        {
          // write ahead -- just write this to the restored response
          wrapped.flushMarkupToWrappedResponse();
        }
      }
  }
View Full Code Here


  @Override
  public BridgeWriteBehindResponse getBridgeWriteBehindResponse(MimeResponse mimeResponse,
    ServletResponse servletResponse) throws FacesException {

    BridgeWriteBehindResponse bridgeWriteBehindResponse = null;

    if ((bridgeWriteBehindRenderResponseClass == null) || (bridgeWriteBehindResourceResponseClass == null)) {

      BridgeContext bridgeContext = BridgeContext.getCurrentInstance();
      BridgeConfig bridgeConfig = bridgeContext.getBridgeConfig();
View Full Code Here

            wrappedServletResponse;
          PortletResponse wrappedPortletResponse = bridgeAfterViewContentPreResponse.getWrapped();

          BridgeWriteBehindSupportFactory bridgeWriteBehindSupportFactory = (BridgeWriteBehindSupportFactory)
            FactoryExtensionFinder.getFactory(BridgeWriteBehindSupportFactory.class);
          BridgeWriteBehindResponse bridgeWriteBehindResponse =
            bridgeWriteBehindSupportFactory.getBridgeWriteBehindResponse((MimeResponse)
              wrappedPortletResponse, facesImplementationServletResponse);

          // Note: See comments in BridgeContextImpl#dispatch(String) regarding Liferay's inability to
          // accept a wrapped response. This is indeed supported in Pluto.
View Full Code Here

TOP

Related Classes of javax.portlet.faces.BridgeWriteBehindResponse

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.