com.liferay.faces.bridge.application.view
Class BridgeWriteBehindResponseMimeImpl

java.lang.Object
  extended by javax.portlet.filter.PortletResponseWrapper
      extended by com.liferay.faces.bridge.filter.MimeResponseWrapper
          extended by com.liferay.faces.bridge.application.view.BridgeWriteBehindResponseMimeImpl
All Implemented Interfaces:
BridgeWriteBehindResponse, javax.portlet.MimeResponse, javax.portlet.PortletResponse
Direct Known Subclasses:
BridgeWriteBehindResponseRenderImpl, BridgeWriteBehindResponseResourceImpl

public class BridgeWriteBehindResponseMimeImpl
extends MimeResponseWrapper
implements BridgeWriteBehindResponse

Section 7.5.2 of the JSF specification requires that JSP-based views have the ability to interleave native HTML markup with the markup generated by JSF component. But as described in Section 6.2.1 of the Portlet Bridge Spec, there is no standard way of supporting this in the JSF API. However, the Portlet Bridge Spec however requires that one part of the interleaving process be supported by the bridge, specifically Bridge.AFTER_VIEW_CONTENT. This feature is responsible for rendering of markup that appears after the closing component tag.

The Portlet Bridge Spec requires that the Bridge.AFTER_VIEW_CONTENT feature be supported by implementing the BridgeWriteBehindResponse interface. However with it is possible to have the JSF implementation (Mojarra or MyFaces) handle the entire interleaving process by itself. So although this class implements the BridgeWriteBehindResponse interface, it only does so for the sake of completeness. The corresponding methods implemented in this class throw UnsupportedOperationException which is OK since they will never be called.

In order to have the JSF implementation handle the entire interleaving process by itself, it is necessary to overcome some Servlet API dependencies. As part of this mechanism, the getPortletOutputStream() and getWriter() methods in this class delegate writing of the response to the underlying ServletResponse.

Author:
Neil Griffin

Field Summary
static String AFTER_VIEW_CONTENT_RESPONSE
           
 
Fields inherited from interface javax.portlet.MimeResponse
CACHE_SCOPE, ETAG, EXPIRATION_CACHE, MARKUP_HEAD_ELEMENT, NAMESPACED_RESPONSE, PRIVATE_SCOPE, PUBLIC_SCOPE, USE_CACHED_CONTENT
 
Constructor Summary
BridgeWriteBehindResponseMimeImpl(javax.portlet.MimeResponse mimeResponse, javax.servlet.ServletResponse servletResponse)
           
 
Method Summary
 void flushMarkupToWrappedResponse()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 byte[] getBytes()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 char[] getChars()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 OutputStream getPortletOutputStream()
           
 PrintWriter getWriter()
           
 boolean hasFacesWriteBehindMarkup()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 boolean isBytes()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 boolean isChars()
          This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.
 void setBufferSize(int size)
           
 
Methods inherited from class com.liferay.faces.bridge.filter.MimeResponseWrapper
createActionURL, createRenderURL, createResourceURL, flushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, reset, resetBuffer, setContentType
 
Methods inherited from class javax.portlet.filter.PortletResponseWrapper
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.PortletResponse
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty
 

Field Detail

AFTER_VIEW_CONTENT_RESPONSE

public static final String AFTER_VIEW_CONTENT_RESPONSE
See Also:
Constant Field Values
Constructor Detail

BridgeWriteBehindResponseMimeImpl

public BridgeWriteBehindResponseMimeImpl(javax.portlet.MimeResponse mimeResponse,
                                         javax.servlet.ServletResponse servletResponse)
Method Detail

flushMarkupToWrappedResponse

public void flushMarkupToWrappedResponse()
                                  throws IOException
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
flushMarkupToWrappedResponse in interface BridgeWriteBehindResponse
Throws:
IOException

hasFacesWriteBehindMarkup

public boolean hasFacesWriteBehindMarkup()
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
hasFacesWriteBehindMarkup in interface BridgeWriteBehindResponse

setBufferSize

public void setBufferSize(int size)
Specified by:
setBufferSize in interface javax.portlet.MimeResponse
Overrides:
setBufferSize in class MimeResponseWrapper

getBytes

public byte[] getBytes()
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
getBytes in interface BridgeWriteBehindResponse

getChars

public char[] getChars()
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
getChars in interface BridgeWriteBehindResponse

getPortletOutputStream

public OutputStream getPortletOutputStream()
                                    throws IOException
Specified by:
getPortletOutputStream in interface javax.portlet.MimeResponse
Overrides:
getPortletOutputStream in class MimeResponseWrapper
Throws:
IOException

isBytes

public boolean isBytes()
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
isBytes in interface BridgeWriteBehindResponse

isChars

public boolean isChars()
This method is required by the BridgeWriteBehindResponse interface but is no longer necessary for JSF 2.

Specified by:
isChars in interface BridgeWriteBehindResponse

getWriter

public PrintWriter getWriter()
                      throws IOException
Specified by:
getWriter in interface javax.portlet.MimeResponse
Overrides:
getWriter in class MimeResponseWrapper
Throws:
IOException


Copyright © 2014 Liferay, Inc.. All Rights Reserved.