javax.portlet

Interface RenderResponse

All Superinterfaces:
PortletResponse

public interface RenderResponse
extends PortletResponse

The RenderResponse defines an object to assist a portlet in sending a response to the portal. It extends the PortletResponse interface to provide specific render response functionality to portlets.
The portlet container creates a RenderResponse object and passes it as argument to the portlet's render method.
See Also:
RenderRequest, PortletResponse

Field Summary

static String
EXPIRATION_CACHE
Property to set the expiration time in seconds for this response using the setProperty method.

Method Summary

PortletURL
createActionURL()
Creates a portlet URL targeting the portlet.
PortletURL
createRenderURL()
Creates a portlet URL targeting the portlet.
void
flushBuffer()
Forces any content in the buffer to be written to the client.
int
getBufferSize()
Returns the actual buffer size used for the response.
String
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response.
String
getContentType()
Returns the MIME type that can be used to contribute markup to the render response.
java.util.Locale
getLocale()
Returns the locale assigned to the response.
String
getNamespace()
The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.
java.io.OutputStream
getPortletOutputStream()
Returns a OutputStream suitable for writing binary data in the response.
java.io.PrintWriter
getWriter()
Returns a PrintWriter object that can send character text to the portal.
boolean
isCommitted()
Returns a boolean indicating if the response has been committed.
void
reset()
Clears any data that exists in the buffer as well as the properties set.
void
resetBuffer()
Clears the content of the underlying buffer in the response without clearing properties set.
void
setBufferSize(int size)
Sets the preferred buffer size for the body of the response.
void
setContentType(String type)
Sets the MIME type for the render response.
void
setTitle(String title)
This method sets the title of the portlet.

Methods inherited from interface javax.portlet.PortletResponse

addProperty, encodeURL, setProperty

Field Details

EXPIRATION_CACHE

public static final String EXPIRATION_CACHE
Property to set the expiration time in seconds for this response using the setProperty method.

If the expiration value is set to 0, caching is disabled for this portlet; if the value is set to -1, the cache does not expire.

The value is "portlet.expiration-cache".

Method Details

createActionURL

public PortletURL createActionURL()
Creates a portlet URL targeting the portlet. If no portlet mode, window state or security modifier is set in the PortletURL the current values are preserved. If a request is triggered by the PortletURL, it results in an action request.

The returned URL can be further extended by adding portlet-specific parameters and portlet modes and window states.

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

Returns:
a portlet action URL

createRenderURL

public PortletURL createRenderURL()
Creates a portlet URL targeting the portlet. If no portlet mode, window state or security modifier is set in the PortletURL the current values are preserved. If a request is triggered by the PortletURL, it results in a render request.

The returned URL can be further extended by adding portlet-specific parameters and portlet modes and window states.

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

Returns:
a portlet render URL

flushBuffer

public void flushBuffer()
            throws java.io.IOException
Forces any content in the buffer to be written to the client. A call to this method automatically commits the response.

getBufferSize

public int getBufferSize()
Returns the actual buffer size used for the response. If no buffering is used, this method returns 0.
Returns:
the actual buffer size used

getCharacterEncoding

public String getCharacterEncoding()
Returns:
a String specifying the name of the charset, for example, ISO-8859-1

getContentType

public String getContentType()
Returns:
the MIME type of the response, or null if no content type is set

getLocale

public java.util.Locale getLocale()
Returns the locale assigned to the response.
Returns:
Locale of this response

getNamespace

public String getNamespace()
The value returned by this method should be prefixed or appended to elements, such as JavaScript variables or function names, to ensure they are unique in the context of the portal page.
Returns:
the namespace

getPortletOutputStream

public java.io.OutputStream getPortletOutputStream()
            throws java.io.IOException
Returns:
a OutputStream for writing binary data

getWriter

public java.io.PrintWriter getWriter()
            throws java.io.IOException
Returns:
a PrintWriter object that can return character data to the portal

isCommitted

public boolean isCommitted()
Returns a boolean indicating if the response has been committed.
Returns:
a boolean indicating if the response has been committed

reset

public void 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.

resetBuffer

public void 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.

setBufferSize

public void setBufferSize(int size)
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 - the preferred buffer size

setContentType

public void setContentType(String type)
Sets the MIME type for the render response. The portlet must set the content type before calling getWriter() or getPortletOutputStream().

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

Parameters:
type - the content MIME type
See Also:
RenderRequest, getContentType()

setTitle

public void setTitle(String title)
This method sets the title of the portlet.

The value can be a text String

Parameters:
title - portlet title as text String or resource URI