public interface ResourceResponse extends MimeResponse
ResourceResponse
defines an object to assist a portlet
for rendering a resource.
The difference between the RenderResponse
is that for the
ResourceResponse
the output of this response is delivered
directly to the client without any additional markup added by the portal.
It is therefore allowed for the portlet to return binary content in this
response.
A portlet can set HTTP headers for the response via the setProperty or
addProperty call in the ResourceResponse
.
To be successfully transmitted back to the client, headers must be set
before the response is committed. Headers set after the response is
committed will be ignored by the portlet container.
The portlet container creates a ResourceResponse
object and
passes it as argument to the portlet's serveResource
method.
ResourceServingPortlet
,
MimeResponse
Modifier and Type | Field and Description |
---|---|
static String |
HTTP_STATUS_CODE
Constant for setting the HTTP status code via the
setProperty method. |
CACHE_SCOPE, ETAG, EXPIRATION_CACHE, MARKUP_HEAD_ELEMENT, NAMESPACED_RESPONSE, PRIVATE_SCOPE, PUBLIC_SCOPE, USE_CACHED_CONTENT
Modifier and Type | Method and Description |
---|---|
PortletURL |
createActionURL()
Creates a portlet URL targeting the portlet.
|
PortletURL |
createRenderURL()
Creates a portlet URL targeting the portlet.
|
ResourceURL |
createResourceURL()
Creates a portlet URL targeting the portlet.
|
void |
setCharacterEncoding(String charset)
Sets the character encoding (MIME charset) of the response being
sent to the client, for example, to UTF-8.
|
void |
setContentLength(int len)
Sets the length of the content body in the response.
|
void |
setLocale(Locale loc)
Sets the locale of the response, setting the headers
(including the Content-Type's charset) as appropriate.
|
flushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getPortletOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentType
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, setProperty
static final String HTTP_STATUS_CODE
setProperty
method.void setLocale(Locale loc)
loc
- the new locale of the responsevoid setCharacterEncoding(String charset)
setContentType(java.lang.String)
or
setLocale(java.util.Locale)
, this method overrides it. Calling
setContentType(java.lang.String)
with the String of
text/html
and calling this method with the String of
UTF-8
is equivalent with calling setContentType
with the String of text/html; charset=UTF-8
.
This method can be called repeatedly to change the character encoding. This method has no effect if it is called after getWriter has been called or after the response has been committed.
charset
- a String specifying only the character set defined by
IANA Character Sets (http://www.iana.org/assignments/character-sets)void setContentLength(int len)
len
- an integer specifying the length of the content being returnedPortletURL createRenderURL()
MimeResponse
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.
createRenderURL
in interface MimeResponse
IllegalStateException
- if the cacheability level of the resource URL
triggering this serveResource
call
is not PAGE
and thus does not allow
for creating render URLs.PortletURL createActionURL()
MimeResponse
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.
createActionURL
in interface MimeResponse
IllegalStateException
- if the cacheability level of the resource URL
triggering this serveResource
call
is not PAGE
and thus does not allow
for creating action URLs.ResourceURL createResourceURL()
MimeResponse
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 per default contain the current
cacheability setting of the parent resource.
If no parent resource is available, PAGE
is the default.
createResourceURL
in interface MimeResponse
IllegalStateException
- if the cacheability level of the resource URL
triggering this serveResource
call,
or one of the parent calls, have defined a stricter
cachability level.Copyright © 2004–2015 The Apache Software Foundation. All rights reserved.