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
TheRenderResponseWrapper
provides a convenient implementation of theRenderResponse
interface 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 Modifier and Type Field Description (package private) RenderResponse
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
Constructors Constructor Description RenderResponseWrapper(RenderResponse response)
Creates anRenderResponse
adaptor wrapping the given response object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PortletURL
createActionURL()
The default behavior of this method is to callcreateActionURL()
on the wrapped response object.PortletURL
createRenderURL()
The default behavior of this method is to callcreateRenderURL()
on the wrapped response object.ResourceURL
createResourceURL()
The default behavior of this method is to callcreateResourceURL()
on the wrapped response object.void
flushBuffer()
The default behavior of this method is to callflushBuffer()
on the wrapped response object.int
getBufferSize()
The default behavior of this method is to callgetBufferSize()
on the wrapped response object.CacheControl
getCacheControl()
The default behavior of this method is to callgetCacheControl()
on the wrapped response object.java.lang.String
getCharacterEncoding()
The default behavior of this method is to callgetCharacterEncoding()
on the wrapped response object.java.lang.String
getContentType()
The default behavior of this method is to callgetContentType()
on the wrapped response object.java.util.Locale
getLocale()
The default behavior of this method is to callgetLocale()
on the wrapped response object.java.io.OutputStream
getPortletOutputStream()
The default behavior of this method is to callgetPortletOutputStream()
on the wrapped response object.RenderResponse
getResponse()
Return the wrapped response object.java.io.PrintWriter
getWriter()
The default behavior of this method is to callgetWriter()
on the wrapped response object.boolean
isCommitted()
The default behavior of this method is to callisCommitted()
on the wrapped response object.void
reset()
The default behavior of this method is to callreset()
on the wrapped response object.void
resetBuffer()
The default behavior of this method is to callresetBuffer()
on the wrapped response object.void
setBufferSize(int size)
The default behavior of this method is to callsetBufferSize(size)
on the wrapped response object.void
setContentType(java.lang.String type)
The default behavior of this method is to callsetContentType(type)
on the wrapped response object.void
setNextPossiblePortletModes(java.util.Collection<PortletMode> portletModes)
The default behavior of this method is to callsetNextPossiblePortletModes()
on the wrapped response object.void
setResponse(RenderResponse response)
Sets the response object being wrapped.void
setTitle(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
-
-
-
-
Field Detail
-
response
RenderResponse response
-
-
Constructor Detail
-
RenderResponseWrapper
public RenderResponseWrapper(RenderResponse response)
Creates anRenderResponse
adaptor 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.IOException
The default behavior of this method is to callflushBuffer()
on the wrapped response object.- Specified by:
flushBuffer
in 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:
getBufferSize
in 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:
getCharacterEncoding
in interfaceMimeResponse
- Returns:
- a
String
specifying 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:
getContentType
in interfaceMimeResponse
- Returns:
- the MIME type of the response, or
null
if 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:
getLocale
in interfaceMimeResponse
- Returns:
- Locale of this response
-
getPortletOutputStream
public java.io.OutputStream getPortletOutputStream() throws java.io.IOException
The default behavior of this method is to callgetPortletOutputStream()
on the wrapped response object.- Specified by:
getPortletOutputStream
in interfaceMimeResponse
- Returns:
- a
OutputStream
for 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.IOException
The default behavior of this method is to callgetWriter()
on the wrapped response object.- Specified by:
getWriter
in interfaceMimeResponse
- Returns:
- a
PrintWriter
object 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:
isCommitted
in 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:
reset
in 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:
resetBuffer
in 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:
setBufferSize
in 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:
setContentType
in interfaceMimeResponse
- Specified by:
setContentType
in 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:
setTitle
in 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:
getCacheControl
in 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:
setNextPossiblePortletModes
in interfaceRenderResponse
- Parameters:
portletModes
-Enumeration
ofPortletMode
objects with the next possible portlet modes that the make sense from the portlet point of view, must not benull
or an empty enumeration.
-
getResponse
public RenderResponse getResponse()
Return the wrapped response object.- Overrides:
getResponse
in 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:
createActionURL
in 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:
createRenderURL
in 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:
createResourceURL
in interfaceMimeResponse
- Returns:
- a portlet resource URL
- Throws:
java.lang.IllegalStateException
-
-