public class ResourceResponseWrapper extends MimeResponseWrapper implements ResourceResponse
ResourceResponseWrapper provides a convenient
implementation of the ResourceResponse 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.ResourceResponseMimeResponse.CopyHTTP_STATUS_CODECACHE_SCOPE, ETAG, EXPIRATION_CACHE, MARKUP_HEAD_ELEMENT, NAMESPACED_RESPONSE, PRIVATE_SCOPE, PUBLIC_SCOPE, USE_CACHED_CONTENT| Constructor and Description |
|---|
ResourceResponseWrapper(ResourceResponse response)
Creates an
ResourceResponse adaptor
wrapping the given response object. |
| Modifier and Type | Method and Description |
|---|---|
ResourceResponse |
getResponse()
Return the wrapped response object.
|
int |
getStatus()
Gets the current HTTP status code for the response.
|
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 |
setContentLengthLong(long 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.
|
void |
setResponse(ResourceResponse response)
Sets the response object being wrapped.
|
void |
setStatus(int sc)
Sets the HTTP status code for this request.
|
createActionURL, createActionURL, createRenderURL, createRenderURL, createResourceURL, flushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getPortletOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentType, setResponseaddProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty, setResponseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateActionURL, createActionURL, createRenderURL, createRenderURL, createResourceURLflushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getPortletOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentTypeaddProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setPropertypublic ResourceResponseWrapper(ResourceResponse response)
ResourceResponse adaptor
wrapping the given response object.response - the event response to wrapIllegalArgumentException - if the response is nullpublic ResourceResponse getResponse()
getResponse in class MimeResponseWrapperpublic void setResponse(ResourceResponse response)
response - the response to setIllegalArgumentException - if the response is null.public void setCharacterEncoding(String charset)
ResourceResponsesetContentType(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.
setCharacterEncoding in interface ResourceResponsecharset - a String specifying only the character set defined by
IANA Character Sets (http://www.iana.org/assignments/character-sets)public void setLocale(Locale loc)
ResourceResponseThis method has no effect if it is called after the response has been committed.
setLocale in interface ResourceResponseloc - the new locale of the responsepublic void setContentLength(int len)
ResourceResponseThis method has no effect if it is called after the response has been committed.
setContentLength in interface ResourceResponselen - an integer specifying the length of the content being returned; sets the Content-Length headerpublic void setStatus(int sc)
ResourceResponse
The status code should be a valid value as defined in
IETF
rfc2616 "Hypertext Transfer Protocol -- HTTP/1.1"
. The status code constants "SC_*" defined in
HttpServletResponse may be used.
This method has no effect if it is called after the response has been committed.
setStatus in interface ResourceResponsesc - an integer specifying the status code for this requestHttpServletResponse,
HttpServletResponse.setStatus(int)public int getStatus()
ResourceResponsegetStatus in interface ResourceResponseHttpServletResponse,
HttpServletResponse.getStatus()public void setContentLengthLong(long len)
ResourceResponseThis method has no effect if it is called after the response has been committed.
setContentLengthLong in interface ResourceResponselen - a long specifying the length of the content being returned; sets the Content-Length headerJava Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.