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.ResourceResponse
MimeResponse.Copy
HTTP_STATUS_CODE
CACHE_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)
The default behavior of this method is to call
setCharacterEncoding(String charset) on the wrapped response object. |
void |
setContentLength(int len)
The default behavior of this method is to call
setContentLength() on the wrapped response object. |
void |
setContentLengthLong(long len)
Sets the length of the content body in the response.
|
void |
setLocale(Locale loc)
The default behavior of this method is to call
setLocale(Locale loc) on the wrapped response object. |
void |
setResponse(ResourceResponse response)
Sets the response object being wrapped.
|
void |
setStatus(int sc)
The default behavior of this method is to call
setStatus() on the wrapped response object. |
createActionURL, createActionURL, createRenderURL, createRenderURL, createResourceURL, flushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getPortletOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentType, setResponse
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty, setResponse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createActionURL, createActionURL, createRenderURL, createRenderURL, createResourceURL
flushBuffer, getBufferSize, getCacheControl, getCharacterEncoding, getContentType, getLocale, getPortletOutputStream, getWriter, isCommitted, reset, resetBuffer, setBufferSize, setContentType
addProperty, addProperty, addProperty, createElement, encodeURL, getNamespace, getProperty, getPropertyNames, getPropertyValues, setProperty
public ResourceResponseWrapper(ResourceResponse response)
ResourceResponse
adaptor
wrapping the given response object.response
- the event response to wrapIllegalArgumentException
- if the response is null
public ResourceResponse getResponse()
getResponse
in class MimeResponseWrapper
public void setResponse(ResourceResponse response)
response
- the response to setIllegalArgumentException
- if the response is null.public void setCharacterEncoding(String charset)
setCharacterEncoding(String charset)
on the wrapped response object.setCharacterEncoding
in interface ResourceResponse
charset
- a String specifying only the character set defined by
IANA Character Sets (http://www.iana.org/assignments/character-sets)public void setLocale(Locale loc)
setLocale(Locale loc)
on the wrapped response object.setLocale
in interface ResourceResponse
loc
- the new locale of the responsepublic void setContentLength(int len)
setContentLength()
on the wrapped response object.setContentLength
in interface ResourceResponse
len
- an integer specifying the length of the content being returned; sets the Content-Length headerpublic void setStatus(int sc)
setStatus()
on the wrapped response object.
setStatus
in interface ResourceResponse
sc
- an integer specifying the status code for this requestHttpServletResponse
,
HttpServletResponse.setStatus(int)
public int getStatus()
ResourceResponse
getStatus
in interface ResourceResponse
HttpServletResponse
,
HttpServletResponse.getStatus()
public void setContentLengthLong(long len)
ResourceResponse
This method has no effect if it is called after the response has been committed.
setContentLengthLong
in interface ResourceResponse
len
- 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.