Top Description Fields Constructors Methods
javax.portlet.filter

public Class MimeResponseWrapper

extends PortletResponseWrapper
implements MimeResponse
Class Inheritance
All Implemented Interfaces
javax.portlet.MimeResponse, javax.portlet.PortletResponse
Known Direct Subclasses
javax.portlet.filter.RenderResponseWrapper, javax.portlet.filter.ResourceResponseWrapper, javax.portlet.filter.HeaderResponseWrapper
Imports
java.io.IOException, .OutputStream, .PrintWriter, java.util.Locale, javax.portlet.ActionURL, .CacheControl, .MimeResponse, .PortletURL, .RenderURL, .ResourceURL

The MimeResponseWrapper provides a convenient implementation of the MimeResponse interface that can be subclassed by developers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped response object.
Since
3.0

Field Summary

Inherited from javax.portlet.filter.PortletResponseWrapper:
response

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T extends PortletURL & ActionURL> T
createActionURL()

Implements javax.portlet.MimeResponse.createActionURL.

Creates an action URL targeting the portlet.
public ActionURL
createActionURL(MimeResponse.Copy
Specifies how current parameters are to be copied to the URL
option
)

Implements javax.portlet.MimeResponse.createActionURL.

Creates an action URL targeting the portlet.
public <T extends PortletURL & RenderURL> T
createRenderURL()

Implements javax.portlet.MimeResponse.createRenderURL.

Creates a render URL targeting the portlet.
public RenderURL
createRenderURL(MimeResponse.Copy
Specifies how current parameters are to be copied to the URL
option
)

Implements javax.portlet.MimeResponse.createRenderURL.

Creates a render URL targeting the portlet.
public ResourceURL
createResourceURL()

Implements javax.portlet.MimeResponse.createResourceURL.

Creates a resource URL targeting the portlet.
public void
flushBuffer()

Implements javax.portlet.MimeResponse.flushBuffer.

Forces any content in the buffer to be written to the underlying output stream.
public int
getBufferSize()

Implements javax.portlet.MimeResponse.getBufferSize.

Returns the actual buffer size used for the response.
public CacheControl
getCacheControl()

Implements javax.portlet.MimeResponse.getCacheControl.

Returns the cache control object allowing to set specific cache settings valid for the markup returned in this response.
public String
getCharacterEncoding()

Implements javax.portlet.MimeResponse.getCharacterEncoding.

Returns the name of the charset used for the MIME body sent in this response.
public String
getContentType()

Implements javax.portlet.MimeResponse.getContentType.

Returns the MIME type that can be used to contribute markup to the render response.
public Locale
getLocale()

Implements javax.portlet.MimeResponse.getLocale.

Returns the locale assigned to the response.
public OutputStream
getPortletOutputStream()

Implements javax.portlet.MimeResponse.getPortletOutputStream.

Returns a OutputStream suitable for writing binary data in the response.
public MimeResponse

Returns:

the wrapped response
getResponse
()

Overrides javax.portlet.filter.PortletResponseWrapper.getResponse.

Return the wrapped response object.
public PrintWriter
getWriter()

Implements javax.portlet.MimeResponse.getWriter.

Returns a PrintWriter object that can send character text to the portal.
public boolean
isCommitted()

Implements javax.portlet.MimeResponse.isCommitted.

Returns a boolean indicating if the response has been committed.
public void
reset()

Implements javax.portlet.MimeResponse.reset.

Clears any data that exists in the buffer as well as the properties set.
public void
resetBuffer()

Implements javax.portlet.MimeResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing properties set.
public void
setBufferSize(int
the preferred buffer size
size
)

Implements javax.portlet.MimeResponse.setBufferSize.

Sets the preferred buffer size for the body of the response.
public void
setContentType(String
the content MIME type
type
)

Implements javax.portlet.MimeResponse.setContentType.

Sets the MIME type for the response.
public void
setResponse(MimeResponse
the response to set
response
)

Sets the response object being wrapped.

Inherited from javax.portlet.filter.PortletResponseWrapper:
addPropertyaddPropertyaddPropertycreateElementencodeURLgetNamespacegetPropertygetPropertyNamesgetPropertyValuessetPropertysetResponse

Constructor Detail

MimeResponseWrapperback to summary
public MimeResponseWrapper(MimeResponse response)

Method Detail

createActionURLback to summary
public <T extends PortletURL & ActionURL> T createActionURL() throws IllegalStateException

Implements javax.portlet.MimeResponse.createActionURL.

Doc from javax.portlet.MimeResponse.createActionURL.

Creates an action URL targeting the portlet. Action URLs are used to create forms or links that, when triggered, update the render state in a non-idempotent manner.

If a request is triggered by the URL, it results in an action request.

The returned action URL will not contain any private render parameters per default not contain any parameters from the current request.

The returned URL can be further extended by adding portlet-specific action parameters, portlet mode, and window state. If no additional portlet mode, window state or security modifier is set on the URL, the values from the current render or resource request are preserved.

Public render parameters do not need to be explicitly added to the returned action URL, unless the public render parameter value is to be changed. Any public render parameters associated with the portlet will automatically be available during action request processing resulting from activation of the URL.

If a public render parameter value is set or removed on an action URL, then the public render parameter will be set to the new value or removed when the URL is activated.

The effect of this method is the same as calling createRenderURL(Copy) with the parameter set to PUBLIC.

Returns:T

a portlet action URL

Annotations
@Override
createActionURLback to summary
public ActionURL createActionURL(MimeResponse.Copy option) throws IllegalStateException

Implements javax.portlet.MimeResponse.createActionURL.

Doc from javax.portlet.MimeResponse.createActionURL.

Creates an action URL targeting the portlet. Action URLs are used to create forms or links that, when triggered, update the render state in a non-idempotent manner.

If a request is triggered by the URL, it results in an action request.

The new action URL will contain render parameters from the current request as specified by the option parameter.

NONE
All public and private parameters are removed from the URL.
ALL
The public and private parameters governing the current request are added to the URL.
PUBLIC
Only public parameters governing the current request are added to the URL.

The returned URL can be further extended by adding action parameters, portlet mode, and window state. If no additional portlet mode, window state or security modifier is set on the URL, the values from the current render or resource request are preserved.

If a public render parameter value is set or removed on an action URL, then the public render parameter will be set to the new value or removed when the URL is activated.

Parameters
option:MimeResponse.Copy

Specifies how current parameters are to be copied to the URL

Returns:ActionURL

a portlet action URL

Annotations
@Override
createRenderURLback to summary
public <T extends PortletURL & RenderURL> T createRenderURL() throws IllegalStateException

Implements javax.portlet.MimeResponse.createRenderURL.

Doc from javax.portlet.MimeResponse.createRenderURL.

Creates a render URL targeting the portlet. Render URLs cause idempotent requests that move the portlet to a new view state, for example, to view a different page of data.

If a request is triggered by the URL, it results in a render request.

The returned render URL will not contain any private render parameters from the current request.

The created URL will per default not contain any parameters of the current render request.

The returned URL can be further extended by adding portlet-specific render parameters, portlet mode, and window state. If no portlet mode, window state or security modifier is set on the URL, the values from the current render or resource request are preserved.

Public render parameters do not need to be explicitly added to the returned render URL, unless the public render parameter value is to be changed. Any public render parameters associated with the portlet will automatically be available during render request processing resulting from activation of the URL.

If a public render parameter value is set or removed on a render URL, then the public render parameter will be set to the new value or removed when the URL is activated.

The effect of this method is the same as calling createRenderURL(Copy) with the parameter set to PUBLIC.

Returns:T

a portlet render URL

Annotations
@Override
createRenderURLback to summary
public RenderURL createRenderURL(MimeResponse.Copy option) throws IllegalStateException

Implements javax.portlet.MimeResponse.createRenderURL.

Doc from javax.portlet.MimeResponse.createRenderURL.

Creates a render URL targeting the portlet. Render URLs cause idempotent requests that move the portlet to a new view state, for example, to view a different page of data.

If a request is triggered by the URL, it results in a render request.

The new render URL will contain render parameters from the current request as specified by the option parameter.

NONE
All public and private parameters are removed from the URL.
ALL
The public and private parameters governing the current request are added to the URL.
PUBLIC
Only public parameters governing the current request are added to the URL.
The URL can be further extended by adding render parameters, portlet mode, and window state. If no additional portlet mode, window state or security modifier is set on the URL, the values from the current render or resource request are preserved.

If a public render parameter value is set or removed on a render URL, then the public render parameter will be set to the new value or removed when the URL is activated.

Parameters
option:MimeResponse.Copy

Specifies how current parameters are to be copied to the URL

Returns:RenderURL

a portlet render URL

Annotations
@Override
createResourceURLback to summary
public ResourceURL createResourceURL() throws IllegalStateException

Implements javax.portlet.MimeResponse.createResourceURL.

Doc from javax.portlet.MimeResponse.createResourceURL.

Creates a resource URL targeting the portlet. Resource URLs are used to trigger requests for content that applies to the current portlet view state.

If a request is triggered by the ResourceURL, it results in a serve resource request of the ResourceServingPortlet interface.

The security settings can be changed for the URL. If the security settings are not explicitly set, the values governing the current request are preserved. The current render parameters, portlet mode, and window state are preserved depending on the cacheability setting for the returned resource URL.

If cacheability is set to PORTLET or PAGE, the values of the render parameters, portlet mode, and window state are preserved. Otherwise, they will not be preserved.

If allowed by the cacheability setting, public and private render parameters are added to the URL with their current values. The render parameter values cannot be changed on the URL.

The URL can be further extended by adding portlet-specific resource parameters.

The URL will contain the current cacheability setting of the parent resource by default. If no parent resource is available, PAGE is the default.

If a request is triggered by the PortletURL, it results in a serve resource request of the ResourceServingPortlet interface.

The returned URL can be further extended by adding portlet-specific parameters .

The created URL will by default contain the current cacheability setting of the parent resource. If no parent resource is available, PAGE is the default.

Returns:ResourceURL

a portlet resource URL

Annotations
@Override
flushBufferback to summary
public void flushBuffer() throws IOException

Implements javax.portlet.MimeResponse.flushBuffer.

Doc from javax.portlet.MimeResponse.flushBuffer.

Forces any content in the buffer to be written to the underlying output stream. A call to this method automatically commits the response.

Annotations
@Override
Exceptions
IOException:
if an error occurred when writing the output
getBufferSizeback to summary
public int getBufferSize()

Implements javax.portlet.MimeResponse.getBufferSize.

Doc from javax.portlet.MimeResponse.getBufferSize.

Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.

Returns:int

the actual buffer size used

Annotations
@Override
getCacheControlback to summary
public CacheControl getCacheControl()

Implements javax.portlet.MimeResponse.getCacheControl.

Doc from javax.portlet.MimeResponse.getCacheControl.

Returns the cache control object allowing to set specific cache settings valid for the markup returned in this response.

Returns:CacheControl

Cache control for the current response.

Annotations
@Override
getCharacterEncodingback to summary
public String getCharacterEncoding()

Implements javax.portlet.MimeResponse.getCharacterEncoding.

Doc from javax.portlet.MimeResponse.getCharacterEncoding.

Returns the name of the charset used for the MIME body sent in this response.

See RFC 2047 for more information about character encoding and MIME.

Returns:String

a String specifying the name of the charset, for example, ISO-8859-1

Annotations
@Override
getContentTypeback to summary
public String getContentType()

Implements javax.portlet.MimeResponse.getContentType.

Doc from javax.portlet.MimeResponse.getContentType.

Returns the MIME type that can be used to contribute markup to the render response.

If no content type was set previously using the setContentType method this method returns null.

Returns:String

the MIME type of the response, or null if no content type is set

Annotations
@Override
getLocaleback to summary
public Locale getLocale()

Implements javax.portlet.MimeResponse.getLocale.

Doc from javax.portlet.MimeResponse.getLocale.

Returns the locale assigned to the response.

Returns:Locale

Locale of this response

Annotations
@Override
getPortletOutputStreamback to summary
public OutputStream getPortletOutputStream() throws IOException

Implements javax.portlet.MimeResponse.getPortletOutputStream.

Doc from javax.portlet.MimeResponse.getPortletOutputStream.

Returns a OutputStream suitable for writing binary data in the response. The portlet container does not encode the binary data.

Before calling this method the content type of the render response must be set using the setContentType method.

Calling flush() on the OutputStream commits the response.

Either this method or getWriter may be called to write the body, not both.

Returns:OutputStream

a OutputStream for writing binary data

Annotations
@Override
Exceptions
IOException:
if an input or output exception occurred
getResponseback to summary
public MimeResponse getResponse()

Overrides javax.portlet.filter.PortletResponseWrapper.getResponse.

Return the wrapped response object.

Returns:MimeResponse

the wrapped response

getWriterback to summary
public PrintWriter getWriter() throws IOException

Implements javax.portlet.MimeResponse.getWriter.

Doc from javax.portlet.MimeResponse.getWriter.

Returns a PrintWriter object that can send character text to the portal.

Before calling this method the content type of the render response should be set using the setContentType method.

Either this method or getPortletOutputStream may be called to write the body, not both.

Returns:PrintWriter

a PrintWriter object that can return character data to the portal

Annotations
@Override
Exceptions
IOException:
if an input or output exception occurred
isCommittedback to summary
public boolean isCommitted()

Implements javax.portlet.MimeResponse.isCommitted.

Doc from javax.portlet.MimeResponse.isCommitted.

Returns a boolean indicating if the response has been committed.

Returns:boolean

a boolean indicating if the response has been committed

Annotations
@Override
resetback to summary
public void reset()

Implements javax.portlet.MimeResponse.reset.

Doc from javax.portlet.MimeResponse.reset.

Clears any data that exists in the buffer as well as the properties set. If the response has been committed, this method throws an IllegalStateException.

Annotations
@Override
resetBufferback to summary
public void resetBuffer()

Implements javax.portlet.MimeResponse.resetBuffer.

Doc from javax.portlet.MimeResponse.resetBuffer.

Clears the content of the underlying buffer in the response without clearing properties set. If the response has been committed, this method throws an IllegalStateException.

Annotations
@Override
setBufferSizeback to summary
public void setBufferSize(int size)

Implements javax.portlet.MimeResponse.setBufferSize.

Doc from javax.portlet.MimeResponse.setBufferSize.

Sets the preferred buffer size for the body of the response. The portlet container will use a buffer at least as large as the size requested.

This method must be called before any response body content is written; if content has been written, or the portlet container does not support buffering, this method may throw an IllegalStateException.

Parameters
size:int

the preferred buffer size

Annotations
@Override
setContentTypeback to summary
public void setContentType(String type)

Implements javax.portlet.MimeResponse.setContentType.

Doc from javax.portlet.MimeResponse.setContentType.

Sets the MIME type for the response. The portlet should set the content type before calling getWriter or getPortletOutputStream. If the content type is not set using this method, the preferred content type as returned by PortletRequest#getResponseContentType is used.

Calling setContentType after getWriter or getOutputStream does not change the content type.

Parameters
type:String

the content MIME type

Annotations
@Override
setResponseback to summary
public void setResponse(MimeResponse response)

Sets the response object being wrapped.

Parameters
response:MimeResponse

the response to set

Exceptions
IllegalArgumentException:
if the response is null.