public class ServletResponseWrapper extends java.lang.Object implements ServletResponse
Constructor and Description |
---|
ServletResponseWrapper(ServletResponse response)
Create a new ServletResponseWrapper, wrapping a specified response.
|
Modifier and Type | Method and Description |
---|---|
void |
flushBuffer()
Flushes the buffer to the client.
|
int |
getBufferSize()
Returns the size of the output buffer.
|
java.lang.String |
getCharacterEncoding()
Returns the character encoding the response is using for output.
|
java.lang.String |
getContentType()
Returns the content type
|
java.util.Locale |
getLocale()
Returns the output locale.
|
ServletOutputStream |
getOutputStream()
Returns an output stream for writing to the client.
|
ServletResponse |
getResponse()
Gets the wrapped response
|
java.io.PrintWriter |
getWriter()
Returns a PrintWriter with the proper character encoding for writing
text data to the client.
|
boolean |
isCommitted()
Returns true if some data has actually been send to the client.
|
boolean |
isWrapperFor(java.lang.Class wrappedType) |
boolean |
isWrapperFor(ServletResponse wrapped) |
void |
reset()
Resets the output stream, clearing headers and the output buffer.
|
void |
resetBuffer()
Resets the output stream without clearing headers and the output buffer.
|
void |
setBufferSize(int size)
Sets the output buffer size to
size . |
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding the response is using for output.
|
void |
setContentLength(int len)
Deprecated.
|
void |
setContentType(java.lang.String type)
Sets the response content type.
|
void |
setLocale(java.util.Locale locale)
Sets the output locale.
|
void |
setResponse(ServletResponse response)
Sets the response to be wrapped.
|
java.lang.String |
toString() |
public ServletResponseWrapper(ServletResponse response)
response
- the response to wrap.public void setResponse(ServletResponse response)
response
- the response to wrap.public ServletResponse getResponse()
public void setContentType(java.lang.String type)
getWriter()
so the writer can use the
proper character encoding.
To set the output character encoding to ISO-8859-2, use the
following:
response.setContentType("text/html; charset=ISO-8859-2");
setContentType
in interface ServletResponse
type
- the mime type of the outputpublic java.lang.String getContentType()
getContentType
in interface ServletResponse
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
public void setCharacterEncoding(java.lang.String encoding)
setCharacterEncoding
in interface ServletResponse
public void setLocale(java.util.Locale locale)
setLocale
in interface ServletResponse
public java.util.Locale getLocale()
getLocale
in interface ServletResponse
public ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface ServletResponse
java.io.IOException
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface ServletResponse
java.io.IOException
public void setBufferSize(int size)
size
. The servlet engine
may round the size up.setBufferSize
in interface ServletResponse
size
- the new output buffer size.public int getBufferSize()
getBufferSize
in interface ServletResponse
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface ServletResponse
java.io.IOException
public boolean isCommitted()
isCommitted
in interface ServletResponse
public void reset()
reset()
after data has been committed is illegal.reset
in interface ServletResponse
java.lang.IllegalStateException
- if isCommitted()
is true.public void resetBuffer()
resetBuffer()
after data has been committed is
illegal.resetBuffer
in interface ServletResponse
java.lang.IllegalStateException
- if isCommitted()
is true.public void setContentLength(int len)
setContentLength
in interface ServletResponse
public boolean isWrapperFor(ServletResponse wrapped)
public boolean isWrapperFor(java.lang.Class wrappedType)
public java.lang.String toString()
toString
in class java.lang.Object