public class ServletResponseWrapper extends java.lang.Object implements ServletResponse
ServletResponse
Constructor and Description |
---|
ServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object.
|
Modifier and Type | Method and Description |
---|---|
void |
flushBuffer()
The default behavior of this method is to call flushBuffer() on the
wrapped response object.
|
int |
getBufferSize()
The default behavior of this method is to return getBufferSize() on the
wrapped response object.
|
java.lang.String |
getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding()
on the wrapped response object.
|
java.lang.String |
getContentType()
The default behavior of this method is to return getContentType() on the
wrapped response object.
|
java.util.Locale |
getLocale()
The default behavior of this method is to return getLocale() on the
wrapped response object.
|
ServletOutputStream |
getOutputStream()
The default behavior of this method is to return getOutputStream() on the
wrapped response object.
|
ServletResponse |
getResponse()
Return the wrapped ServletResponse object.
|
java.io.PrintWriter |
getWriter()
The default behavior of this method is to return getWriter() on the
wrapped response object.
|
boolean |
isCommitted()
The default behavior of this method is to return isCommitted() on the
wrapped response object.
|
boolean |
isWrapperFor(java.lang.Class<?> wrappedType)
TODO SERVLET3 - Add comments
|
boolean |
isWrapperFor(ServletResponse wrapped)
TODO SERVLET3 - Add comments
|
void |
reset()
The default behavior of this method is to call reset() on the wrapped
response object.
|
void |
resetBuffer()
The default behavior of this method is to call resetBuffer() on the
wrapped response object.
|
void |
setBufferSize(int size)
The default behavior of this method is to call setBufferSize(int size) on
the wrapped response object.
|
void |
setCharacterEncoding(java.lang.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(int len)
on the wrapped response object.
|
void |
setContentLengthLong(long length)
The default behavior of this method is to call setContentLength(long len)
on the wrapped response object.
|
void |
setContentType(java.lang.String type)
The default behavior of this method is to call setContentType(String
type) on the wrapped response object.
|
void |
setLocale(java.util.Locale loc)
The default behavior of this method is to call setLocale(Locale loc) on
the wrapped response object.
|
void |
setResponse(ServletResponse response)
Sets the response being wrapped.
|
public ServletResponseWrapper(ServletResponse response)
response
- The response to wrapjava.lang.IllegalArgumentException
- if the response is null.public ServletResponse getResponse()
public void setResponse(ServletResponse response)
response
- The new response to wrapjava.lang.IllegalArgumentException
- if the response is null.public void setCharacterEncoding(java.lang.String charset)
setCharacterEncoding
in interface ServletResponse
charset
- a String specifying only the character set defined by IANA
Character Sets
(http://www.iana.org/assignments/character-sets)#setLocale
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
String
specifying the name of the character
encoding, for example, UTF-8
public ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface ServletResponse
ServletOutputStream
for writing binary datajava.io.IOException
- if an input or output exception occurredServletResponse.getWriter()
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface ServletResponse
PrintWriter
object that can return character data
to the clientjava.io.UnsupportedEncodingException
- if the character encoding returned by
getCharacterEncoding
cannot be usedjava.io.IOException
- if an input or output exception occurredServletResponse.getOutputStream()
,
ServletResponse.setCharacterEncoding(java.lang.String)
public void setContentLength(int len)
setContentLength
in interface ServletResponse
len
- an integer specifying the length of the content being returned
to the client; sets the Content-Length headerpublic void setContentLengthLong(long length)
setContentLengthLong
in interface ServletResponse
length
- an integer specifying the length of the content being returned
to the client; sets the Content-Length headerpublic void setContentType(java.lang.String type)
setContentType
in interface ServletResponse
type
- a String
specifying the MIME type of the contentServletResponse.setLocale(java.util.Locale)
,
ServletResponse.setCharacterEncoding(java.lang.String)
,
ServletResponse.getOutputStream()
,
ServletResponse.getWriter()
public java.lang.String getContentType()
getContentType
in interface ServletResponse
String
specifying the content type, for example,
text/html; charset=UTF-8
, or nullpublic void setBufferSize(int size)
setBufferSize
in interface ServletResponse
size
- the preferred buffer sizeServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public int getBufferSize()
getBufferSize
in interface ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface ServletResponse
java.io.IOException
- if an I/O occurs during the flushing of the responseServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public boolean isCommitted()
isCommitted
in interface ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.reset()
public void reset()
reset
in interface ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
public void resetBuffer()
resetBuffer
in interface ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public void setLocale(java.util.Locale loc)
setLocale
in interface ServletResponse
loc
- the locale of the responseServletResponse.getLocale()
,
ServletResponse.setContentType(java.lang.String)
,
ServletResponse.setCharacterEncoding(java.lang.String)
public java.util.Locale getLocale()
getLocale
in interface ServletResponse
ServletResponse.setLocale(java.util.Locale)
method. If no locale has been specified, the
container's default locale is returned.ServletResponse.setLocale(java.util.Locale)
public boolean isWrapperFor(ServletResponse wrapped)
wrapped
- The response to compare to the wrapped responsetrue
if the response wrapped by this wrapper (or
series of wrappers) is the same as the supplied response,
otherwise false
public boolean isWrapperFor(java.lang.Class<?> wrappedType)
wrappedType
- The class to compare to the class of the wrapped
responsetrue
if the response wrapped by this wrapper (or
series of wrappers) is the same type as the supplied type,
otherwise false
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.