Package javax.portlet.filter
Class RenderResponseWrapper
- java.lang.Object
-
- javax.portlet.filter.PortletResponseWrapper
-
- javax.portlet.filter.RenderResponseWrapper
-
- All Implemented Interfaces:
MimeResponse,PortletResponse,RenderResponse
public class RenderResponseWrapper extends PortletResponseWrapper implements RenderResponse
TheRenderResponseWrapperprovides a convenient implementation of theRenderResponseinterface that can be subclassed by developers wishing to adapt the response. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped response object.- Since:
- 2.0
- See Also:
RenderResponse
-
-
Field Summary
-
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
Constructors Constructor Description RenderResponseWrapper(RenderResponse response)Creates anRenderResponseadaptor wrapping the given response object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PortletURLcreateActionURL()The default behavior of this method is to callcreateActionURL()on the wrapped response object.PortletURLcreateRenderURL()The default behavior of this method is to callcreateRenderURL()on the wrapped response object.ResourceURLcreateResourceURL()The default behavior of this method is to callcreateResourceURL()on the wrapped response object.voidflushBuffer()The default behavior of this method is to callflushBuffer()on the wrapped response object.intgetBufferSize()The default behavior of this method is to callgetBufferSize()on the wrapped response object.CacheControlgetCacheControl()The default behavior of this method is to callgetCacheControl()on the wrapped response object.java.lang.StringgetCharacterEncoding()The default behavior of this method is to callgetCharacterEncoding()on the wrapped response object.java.lang.StringgetContentType()The default behavior of this method is to callgetContentType()on the wrapped response object.java.util.LocalegetLocale()The default behavior of this method is to callgetLocale()on the wrapped response object.java.io.OutputStreamgetPortletOutputStream()The default behavior of this method is to callgetPortletOutputStream()on the wrapped response object.RenderResponsegetResponse()Return the wrapped response object.java.io.PrintWritergetWriter()The default behavior of this method is to callgetWriter()on the wrapped response object.booleanisCommitted()The default behavior of this method is to callisCommitted()on the wrapped response object.voidreset()The default behavior of this method is to callreset()on the wrapped response object.voidresetBuffer()The default behavior of this method is to callresetBuffer()on the wrapped response object.voidsetBufferSize(int size)The default behavior of this method is to callsetBufferSize(size)on the wrapped response object.voidsetContentType(java.lang.String type)The default behavior of this method is to callsetContentType(type)on the wrapped response object.voidsetNextPossiblePortletModes(java.util.Collection<PortletMode> portletModes)The default behavior of this method is to callsetNextPossiblePortletModes()on the wrapped response object.voidsetResponse(RenderResponse response)Sets the response object being wrapped.voidsetTitle(java.lang.String title)The default behavior of this method is to callsetTitle(title)on the wrapped response object.-
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
-
-
-
-
Constructor Detail
-
RenderResponseWrapper
public RenderResponseWrapper(RenderResponse response)
Creates anRenderResponseadaptor wrapping the given response object.- Parameters:
response- the event response to wrap- Throws:
java.lang.IllegalArgumentException- if the response isnull
-
-
Method Detail
-
flushBuffer
public void flushBuffer() throws java.io.IOExceptionThe default behavior of this method is to callflushBuffer()on the wrapped response object.- Specified by:
flushBufferin interfaceMimeResponse- Throws:
java.io.IOException- if an error occurred when writing the output- See Also:
MimeResponse.setBufferSize(int),MimeResponse.getBufferSize(),MimeResponse.isCommitted(),MimeResponse.reset()
-
getBufferSize
public int getBufferSize()
The default behavior of this method is to callgetBufferSize()on the wrapped response object.- Specified by:
getBufferSizein interfaceMimeResponse- Returns:
- the actual buffer size used
- See Also:
MimeResponse.setBufferSize(int),MimeResponse.flushBuffer(),MimeResponse.isCommitted(),MimeResponse.reset()
-
getCharacterEncoding
public java.lang.String getCharacterEncoding()
The default behavior of this method is to callgetCharacterEncoding()on the wrapped response object.- Specified by:
getCharacterEncodingin interfaceMimeResponse- Returns:
- a
Stringspecifying the name of the charset, for example,ISO-8859-1
-
getContentType
public java.lang.String getContentType()
The default behavior of this method is to callgetContentType()on the wrapped response object.- Specified by:
getContentTypein interfaceMimeResponse- Returns:
- the MIME type of the response, or
nullif no content type is set - See Also:
MimeResponse.setContentType(java.lang.String)
-
getLocale
public java.util.Locale getLocale()
The default behavior of this method is to callgetLocale()on the wrapped response object.- Specified by:
getLocalein interfaceMimeResponse- Returns:
- Locale of this response
-
getPortletOutputStream
public java.io.OutputStream getPortletOutputStream() throws java.io.IOExceptionThe default behavior of this method is to callgetPortletOutputStream()on the wrapped response object.- Specified by:
getPortletOutputStreamin interfaceMimeResponse- Returns:
- a
OutputStreamfor writing binary data - Throws:
java.io.IOException- if an input or output exception occurred- See Also:
MimeResponse.setContentType(java.lang.String),MimeResponse.getWriter()
-
getWriter
public java.io.PrintWriter getWriter() throws java.io.IOExceptionThe default behavior of this method is to callgetWriter()on the wrapped response object.- Specified by:
getWriterin interfaceMimeResponse- Returns:
- a
PrintWriterobject that can return character data to the portal - Throws:
java.io.IOException- if an input or output exception occurred- See Also:
MimeResponse.setContentType(java.lang.String),MimeResponse.getPortletOutputStream()
-
isCommitted
public boolean isCommitted()
The default behavior of this method is to callisCommitted()on the wrapped response object.- Specified by:
isCommittedin interfaceMimeResponse- Returns:
- a boolean indicating if the response has been committed
- See Also:
MimeResponse.setBufferSize(int),MimeResponse.getBufferSize(),MimeResponse.flushBuffer(),MimeResponse.reset()
-
reset
public void reset()
The default behavior of this method is to callreset()on the wrapped response object.- Specified by:
resetin interfaceMimeResponse- See Also:
MimeResponse.setBufferSize(int),MimeResponse.getBufferSize(),MimeResponse.flushBuffer(),MimeResponse.isCommitted()
-
resetBuffer
public void resetBuffer()
The default behavior of this method is to callresetBuffer()on the wrapped response object.- Specified by:
resetBufferin interfaceMimeResponse- See Also:
MimeResponse.setBufferSize(int),MimeResponse.getBufferSize(),MimeResponse.isCommitted(),MimeResponse.reset()
-
setBufferSize
public void setBufferSize(int size)
The default behavior of this method is to callsetBufferSize(size)on the wrapped response object.- Specified by:
setBufferSizein interfaceMimeResponse- Parameters:
size- the preferred buffer size- See Also:
MimeResponse.getBufferSize(),MimeResponse.flushBuffer(),MimeResponse.isCommitted(),MimeResponse.reset()
-
setContentType
public void setContentType(java.lang.String type)
The default behavior of this method is to callsetContentType(type)on the wrapped response object.- Specified by:
setContentTypein interfaceMimeResponse- Specified by:
setContentTypein interfaceRenderResponse- Parameters:
type- the content MIME type- See Also:
PortletRequest.getResponseContentTypes(),MimeResponse.getContentType()
-
setTitle
public void setTitle(java.lang.String title)
The default behavior of this method is to callsetTitle(title)on the wrapped response object.- Specified by:
setTitlein interfaceRenderResponse- Parameters:
title- portlet title as text String or resource URI
-
getCacheControl
public CacheControl getCacheControl()
The default behavior of this method is to callgetCacheControl()on the wrapped response object.- Specified by:
getCacheControlin interfaceMimeResponse- Returns:
- Cache control for the current response.
-
setNextPossiblePortletModes
public void setNextPossiblePortletModes(java.util.Collection<PortletMode> portletModes)
The default behavior of this method is to callsetNextPossiblePortletModes()on the wrapped response object.- Specified by:
setNextPossiblePortletModesin interfaceRenderResponse- Parameters:
portletModes-EnumerationofPortletModeobjects with the next possible portlet modes that the make sense from the portlet point of view, must not benullor an empty enumeration.
-
getResponse
public RenderResponse getResponse()
Return the wrapped response object.- Overrides:
getResponsein classPortletResponseWrapper- Returns:
- the wrapped response
-
setResponse
public void setResponse(RenderResponse response)
Sets the response object being wrapped.- Parameters:
response- the response to set- Throws:
java.lang.IllegalArgumentException- if the response is null.
-
createActionURL
public PortletURL createActionURL() throws java.lang.IllegalStateException
The default behavior of this method is to callcreateActionURL()on the wrapped response object.- Specified by:
createActionURLin interfaceMimeResponse- Returns:
- a portlet action URL
- Throws:
java.lang.IllegalStateException
-
createRenderURL
public PortletURL createRenderURL() throws java.lang.IllegalStateException
The default behavior of this method is to callcreateRenderURL()on the wrapped response object.- Specified by:
createRenderURLin interfaceMimeResponse- Returns:
- a portlet render URL
- Throws:
java.lang.IllegalStateException
-
createResourceURL
public ResourceURL createResourceURL() throws java.lang.IllegalStateException
The default behavior of this method is to callcreateResourceURL()on the wrapped response object.- Specified by:
createResourceURLin interfaceMimeResponse- Returns:
- a portlet resource URL
- Throws:
java.lang.IllegalStateException
-
-