Top Description Inners Fields Methods
javax.portlet

public Interface MimeResponse

extends PortletResponse
Known Direct Subinterfaces
javax.portlet.RenderResponse, javax.portlet.ResourceResponse, javax.portlet.HeaderResponse
Known Direct Implementers
javax.portlet.filter.MimeResponseWrapper

The MimeResponse defines the base interface to assist a portlet in returning MIME content.
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
MimeResponse.Copy

Specifies processing when a URL is created.

Field Summary

Modifier and TypeField and Description
public static final String
CACHE_SCOPE

Property to set the cache scope for this response using the setProperty method intended to be used in forwarded or included servlets/JSPs.

public static final String
ETAG

Property to tell the portlet container the new ETag for this response intended to be used in forwarded or included servlets/JSPs.

public static final String
EXPIRATION_CACHE

Property to set the expiration time in seconds for this response using the setProperty method intended to be used in forwarded or included servlets/JSPs.

public static final String
MARKUP_HEAD_ELEMENT

Property intended to be a hint to the portal application that the provided DOM element should be added to the markup head section of the response to the client.

public static final String
NAMESPACED_RESPONSE

Property intended to be a hint to the portal application that the returned content is completely namespaced.

public static final String
PRIVATE_SCOPE

Private cache scope, indicating that the cache entry must not be shared across users.

public static final String
PUBLIC_SCOPE

Public cache scope, indicating that the cache entry can be shared across users.

public static final String
USE_CACHED_CONTENT

Property to tell the portlet container to use the cached markup for the validation token provided in the request.

Method Summary

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

Returns:

a portlet action URL
createActionURL
()

Creates an action URL targeting the portlet.
public ActionURL

Returns:

a portlet action URL
createActionURL
(MimeResponse.Copy
Specifies how current parameters are to be copied to the URL
option
)

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

Returns:

a portlet render URL
createRenderURL
()

Creates a render URL targeting the portlet.
public RenderURL

Returns:

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

Creates a render URL targeting the portlet.
public ResourceURL

Returns:

a portlet resource URL
createResourceURL
()

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

Forces any content in the buffer to be written to the underlying output stream.

public int

Returns:

the actual buffer size used
getBufferSize
()

Returns the actual buffer size used for the response.

public CacheControl

Returns:

Cache control for the current response.
getCacheControl
()

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

public String

Returns:

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

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

public String

Returns:

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

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

public Locale

Returns:

Locale of this response
getLocale
()

Returns the locale assigned to the response.

public OutputStream

Returns:

a OutputStream for writing binary data
getPortletOutputStream
()

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

public PrintWriter

Returns:

a PrintWriter object that can return character data to the portal
getWriter
()

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

public boolean

Returns:

a boolean indicating if the response has been committed
isCommitted
()

Returns a boolean indicating if the response has been committed.

public void
reset()

Clears any data that exists in the buffer as well as the properties set.

public void
resetBuffer()

Clears the content of the underlying buffer in the response without clearing properties set.

public void
setBufferSize(int
the preferred buffer size
size
)

Sets the preferred buffer size for the body of the response.

public void
setContentType(String
the content MIME type
type
)

Sets the MIME type for the response.

Inherited from javax.portlet.PortletResponse:
addPropertyaddPropertyaddPropertycreateElementencodeURLgetNamespacegetPropertygetPropertyNamesgetPropertyValuessetProperty

Field Detail

CACHE_SCOPEback to summary
public static final String CACHE_SCOPE

Property to set the cache scope for this response using the setProperty method intended to be used in forwarded or included servlets/JSPs.

Predefined cache scopes are: PUBLIC_SCOPE and PRIVATE_SCOPE.

A default can be defined in the portlet deployment descriptor with the cache-scope tag, otherwise it is PRIVATE_SCOPE.

Values that are not either PUBLIC_SCOPE or PRIVATE_SCOPE are treated as PRIVATE_SCOPE.

The value is "portlet.cache-scope".

Since
2.0
See Also
CacheControl
ETAGback to summary
public static final String ETAG

Property to tell the portlet container the new ETag for this response intended to be used in forwarded or included servlets/JSPs.

This property needs to be set using the setProperty method.

The value is "portlet.ETag ".

Since
2.0
See Also
CacheControl
EXPIRATION_CACHEback to summary
public static final String EXPIRATION_CACHE

Property to set the expiration time in seconds for this response using the setProperty method intended to be used in forwarded or included servlets/JSPs.

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.

A default can be defined in the portlet deployment descriptor with the expiration-cache tag, otherwise it is 0.

Non-integer values are treated as 0.

The value is "portlet.expiration-cache".

See Also
CacheControl
MARKUP_HEAD_ELEMENTback to summary
public static final String MARKUP_HEAD_ELEMENT

Property intended to be a hint to the portal application that the provided DOM element should be added to the markup head section of the response to the client.

Support for this property is optional and the portlet can verify if the calling portal supports this property via the MARKUP_HEAD_ELEMENT_SUPPORT property on the PortalContext.

Even if the calling portal support this property delivery of the DOM element to the client cannot be guaranteed, e.g. due to possible security rules of the portal application or elements that conflict with the response of other portlets.

This property needs to be set using the setProperty(String key,org.w3c.dom.Element element) method.

The value is "javax.portlet.markup.head.element".

Since
2.0
NAMESPACED_RESPONSEback to summary
public static final String NAMESPACED_RESPONSE

Property intended to be a hint to the portal application that the returned content is completely namespaced. This includes all markup id elements, form fields, etc. One example where this is might be used is for portal applications that are form-based and thus need to re-write any forms included in the portlet markup.

This property needs to be set using the setProperty method with a non-null value. The value itself is not evaluated.

The value is "X-JAVAX-PORTLET-NAMESPACED-RESPONSE".

Since
2.0
PRIVATE_SCOPEback to summary
public static final String PRIVATE_SCOPE

Private cache scope, indicating that the cache entry must not be shared across users. The value is "portlet.private-scope".

Since
2.0
PUBLIC_SCOPEback to summary
public static final String PUBLIC_SCOPE

Public cache scope, indicating that the cache entry can be shared across users. The value is "portlet.public-scope".

Since
2.0
USE_CACHED_CONTENTback to summary
public static final String USE_CACHED_CONTENT

Property to tell the portlet container to use the cached markup for the validation token provided in the request. This property needs to be set using the setProperty method with a non-null value and is intended to be used in forwarded or included servlets/JSPs. The value itself is not evaluated.

The value is "portlet.use-cached-content ".

Since
2.0
See Also
CacheControl

Method Detail

createActionURLback to summary
public <T extends PortletURL & ActionURL> T 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

createActionURLback to summary
public ActionURL createActionURL(MimeResponse.Copy option)

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

Since
3.0
See Also
Copy
createRenderURLback to summary
public <T extends PortletURL & RenderURL> T 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

createRenderURLback to summary
public RenderURL createRenderURL(MimeResponse.Copy option)

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

Since
3.0
See Also
Copy
createResourceURLback to summary
public ResourceURL 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

Since
2.0
flushBufferback to summary
public void flushBuffer() throws IOException

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

Exceptions
IOException:
if an error occurred when writing the output
See Also
setBufferSize, getBufferSize, isCommitted, reset
getBufferSizeback to summary
public int 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

See Also
setBufferSize, flushBuffer, isCommitted, reset
getCacheControlback to summary
public CacheControl 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.

Since
2.0
getCharacterEncodingback to summary
public String 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

getContentTypeback to summary
public String 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

See Also
setContentType
getLocaleback to summary
public Locale getLocale()

Returns the locale assigned to the response.

Returns:Locale

Locale of this response

getPortletOutputStreamback to summary
public OutputStream getPortletOutputStream() throws IOException

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

Exceptions
IOException:
if an input or output exception occurred
IllegalStateException:
if the getWriter method has been called on this response.
See Also
setContentType, getWriter
getWriterback to summary
public PrintWriter getWriter() throws IOException

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

Exceptions
IOException:
if an input or output exception occurred
IllegalStateException:
if the getPortletOutputStream method has been called on this response.
See Also
setContentType, getPortletOutputStream
isCommittedback to summary
public boolean isCommitted()

Returns a boolean indicating if the response has been committed.

Returns:boolean

a boolean indicating if the response has been committed

See Also
setBufferSize, getBufferSize, flushBuffer, reset
resetback to summary
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.

Exceptions
IllegalStateException:
if the response has already been committed
See Also
setBufferSize, getBufferSize, flushBuffer, isCommitted
resetBufferback to summary
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.

Exceptions
IllegalStateException:
if this method is called after response is committed
See Also
setBufferSize, getBufferSize, isCommitted, reset
setBufferSizeback to summary
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:int

the preferred buffer size

Exceptions
IllegalStateException:
if this method is called after content has been written, or the portlet container does not support buffering
See Also
getBufferSize, flushBuffer, isCommitted, reset
setContentTypeback to summary
public void setContentType(String type)

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

Exceptions
IllegalArgumentException:
if the content type is invalid.
See Also
PortletRequest#getResponseContentTypes, getContentType
javax.portlet back to summary

public final Enum MimeResponse.Copy

extends Enum<MimeResponse.Copy>
Class Inheritance

Specifies processing when a URL is created.
Since
3.0
See Also
createActionURL(Copy), createRenderURL(Copy)

Field Summary

Modifier and TypeField and Description
public static final MimeResponse.Copy
ALL

Specifies that the public and private render parameters set for the current request are be copied to the URL when it is created.
public static final MimeResponse.Copy
NONE

Specifies that no parameters are to be copied when a URL is created.
public static final MimeResponse.Copy
PUBLIC

Specifies that only the public render parameters set for the current request are be copied to the URL when it is created.

Constructor Summary

AccessConstructor and Description
private
Copy()

Method Summary

Modifier and TypeMethod and Description
public static MimeResponse.Copy
public static MimeResponse.Copy[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALLback to summary
public static final MimeResponse.Copy ALL

Specifies that the public and private render parameters set for the current request are be copied to the URL when it is created.
Since
3.0
NONEback to summary
public static final MimeResponse.Copy NONE

Specifies that no parameters are to be copied when a URL is created.
Since
3.0
PUBLICback to summary
public static final MimeResponse.Copy PUBLIC

Specifies that only the public render parameters set for the current request are be copied to the URL when it is created.
Since
3.0

Constructor Detail

Copyback to summary
private Copy()

Method Detail

valueOfback to summary
public static MimeResponse.Copy valueOf(String name)
valuesback to summary
public static MimeResponse.Copy[] values()