|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.ServletResponseWrapper
Provides a convenient implementation of the ServletResponse interface that can be subclassed by developers wishing to adapt the response from a Servlet. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped response object.
ServletResponse
Constructor Summary | |
ServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object. |
Method Summary | |
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.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. |
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 |
setContentLength(int len)
The default behavior of this method is to call setContentLength(int 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServletResponseWrapper(ServletResponse response)
java.lang.IllegalArgumentException
- if the response is null.Method Detail |
public ServletResponse getResponse()
public void setResponse(ServletResponse response)
java.lang.IllegalArgumentException
- if the response is null.public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
javax.servlet.ServletResponse
String
specifying the
name of the charset, for
example, ISO-8859-1
public ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface ServletResponse
javax.servlet.ServletResponse
ServletOutputStream
for writing binary datajava.lang.IllegalStateException
- if the getWriter
method
has been called on this responsejava.io.IOException
- if an input or output exception occurredServletResponse.getWriter()
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface ServletResponse
javax.servlet.ServletResponse
PrintWriter
object that
can return character data to the clientjava.io.UnsupportedEncodingException
- if the charset specified in
setContentType
cannot be
usedjava.lang.IllegalStateException
- if the getOutputStream
method has already been called for this
response objectjava.io.IOException
- if an input or output exception occurredServletResponse.getOutputStream()
,
ServletResponse.setContentType(java.lang.String)
public void setContentLength(int len)
setContentLength
in interface ServletResponse
javax.servlet.ServletResponse
len
- 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
javax.servlet.ServletResponse
type
- a String
specifying the MIME
type of the contentServletResponse.getOutputStream()
,
ServletResponse.getWriter()
public void setBufferSize(int size)
setBufferSize
in interface ServletResponse
javax.servlet.ServletResponse
size
- the preferred buffer sizejava.lang.IllegalStateException
- if this method is called after
content has been writtenServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public int getBufferSize()
getBufferSize
in interface ServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface ServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public boolean isCommitted()
isCommitted
in interface ServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.reset()
public void reset()
reset
in interface ServletResponse
javax.servlet.ServletResponse
java.lang.IllegalStateException
- if the response has already been
committedServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.flushBuffer()
,
ServletResponse.isCommitted()
public void resetBuffer()
resetBuffer
in interface ServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,
ServletResponse.getBufferSize()
,
ServletResponse.isCommitted()
,
ServletResponse.reset()
public void setLocale(java.util.Locale loc)
setLocale
in interface ServletResponse
javax.servlet.ServletResponse
loc
- the locale of the responseServletResponse.getLocale()
public java.util.Locale getLocale()
getLocale
in interface ServletResponse
javax.servlet.ServletResponse
ServletResponse.setLocale(java.util.Locale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |