Movatterモバイル変換


[0]ホーム

URL:


         


Class ServletResponseWrapper

java.lang.Object  |  +--javax.servlet.ServletResponseWrapper
All Implemented Interfaces:
ServletResponse
Direct Known Subclasses:
HttpServletResponseWrapper

public classServletResponseWrapper
extends java.lang.Object
implementsServletResponse

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.

Since:
v 2.3
See Also:
ServletResponse

ServletResponseWrapper(ServletResponse response)
          Creates a ServletResponse adaptor wrapping the given response object.
 
flushBuffer()
          The default behavior of this method is to call flushBuffer() on the wrapped response object.
getBufferSize()
          The default behavior of this method is to return getBufferSize() on the wrapped response object.
getCharacterEncoding()
          The default behavior of this method is to return getCharacterEncoding() on the wrapped response object.
getLocale()
          The default behavior of this method is to return getLocale() on the wrapped response object.
getOutputStream()
          The default behavior of this method is to return getOutputStream() on the wrapped response object.
getResponse()
          Return the wrapped ServletResponse object.
getWriter()
          The default behavior of this method is to return getWriter() on the wrapped response object.
isCommitted()
          The default behavior of this method is to return isCommitted() on the wrapped response object.
reset()
          The default behavior of this method is to call reset() on the wrapped response object.
resetBuffer()
          The default behavior of this method is to call resetBuffer() on the wrapped response object.
setBufferSize(int size)
          The default behavior of this method is to call setBufferSize(int size) on the wrapped response object.
setContentLength(int len)
          The default behavior of this method is to call setContentLength(int len) on the wrapped response object.
setContentType(java.lang.String type)
          The default behavior of this method is to call setContentType(String type) on the wrapped response object.
setLocale(java.util.Locale loc)
          The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object.
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
 

ServletResponseWrapper

publicServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object.
Throws:
java.lang.IllegalArgumentException - if the response is null.

getResponse

publicServletResponsegetResponse()
Return the wrapped ServletResponse object.

setResponse

public voidsetResponse(ServletResponse response)
Sets the response being wrapped.
Throws:
java.lang.IllegalArgumentException - if the response is null.

getCharacterEncoding

public java.lang.StringgetCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped response object.
Specified by:
getCharacterEncoding in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Returns:
aString specifying thename of the charset, forexample,ISO-8859-1

getOutputStream

publicServletOutputStreamgetOutputStream()                                    throws java.io.IOException
The default behavior of this method is to return getOutputStream() on the wrapped response object.
Specified by:
getOutputStream in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Returns:
aServletOutputStream for writing binary data
Throws:
java.lang.IllegalStateException - if thegetWriter method has been called on this response
java.io.IOException - if an input or output exception occurred
See Also:
ServletResponse.getWriter()

getWriter

public java.io.PrintWritergetWriter()                              throws java.io.IOException
The default behavior of this method is to return getWriter() on the wrapped response object.
Specified by:
getWriter in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Returns:
aPrintWriter object that can return character data to the client
Throws:
java.io.UnsupportedEncodingException - if the charset specified insetContentType cannot beused
java.lang.IllegalStateException - if thegetOutputStream method has already been called for this response object
java.io.IOException - if an input or output exception occurred
See Also:
ServletResponse.getOutputStream(),ServletResponse.setContentType(java.lang.String)

setContentLength

public voidsetContentLength(int len)
The default behavior of this method is to call setContentLength(int len) on the wrapped response object.
Specified by:
setContentLength in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Parameters:
len - an integer specifying the length of the content being returned to the client; setsthe Content-Length header

setContentType

public voidsetContentType(java.lang.String type)
The default behavior of this method is to call setContentType(String type) on the wrapped response object.
Specified by:
setContentType in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Parameters:
type - aString specifying the MIME type of the content
See Also:
ServletResponse.getOutputStream(),ServletResponse.getWriter()

setBufferSize

public voidsetBufferSize(int size)
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object.
Specified by:
setBufferSize in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Parameters:
size - the preferred buffer size
Throws:
java.lang.IllegalStateException - if this method is called aftercontent has been written
See Also:
ServletResponse.getBufferSize(),ServletResponse.flushBuffer(),ServletResponse.isCommitted(),ServletResponse.reset()

getBufferSize

public intgetBufferSize()
The default behavior of this method is to return getBufferSize() on the wrapped response object.
Specified by:
getBufferSize in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Returns:
the actual buffer size used
See Also:
ServletResponse.setBufferSize(int),ServletResponse.flushBuffer(),ServletResponse.isCommitted(),ServletResponse.reset()

flushBuffer

public voidflushBuffer()                 throws java.io.IOException
The default behavior of this method is to call flushBuffer() on the wrapped response object.
Specified by:
flushBuffer in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
See Also:
ServletResponse.setBufferSize(int),ServletResponse.getBufferSize(),ServletResponse.isCommitted(),ServletResponse.reset()

isCommitted

public booleanisCommitted()
The default behavior of this method is to return isCommitted() on the wrapped response object.
Specified by:
isCommitted in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Returns:
a boolean indicating if the response has been committed
See Also:
ServletResponse.setBufferSize(int),ServletResponse.getBufferSize(),ServletResponse.flushBuffer(),ServletResponse.reset()

reset

public voidreset()
The default behavior of this method is to call reset() on the wrapped response object.
Specified by:
reset in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Throws:
java.lang.IllegalStateException - if the response has already been committed
See Also:
ServletResponse.setBufferSize(int),ServletResponse.getBufferSize(),ServletResponse.flushBuffer(),ServletResponse.isCommitted()

resetBuffer

public voidresetBuffer()
The default behavior of this method is to call resetBuffer() on the wrapped response object.
Specified by:
resetBuffer in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
See Also:
ServletResponse.setBufferSize(int),ServletResponse.getBufferSize(),ServletResponse.isCommitted(),ServletResponse.reset()

setLocale

public voidsetLocale(java.util.Locale loc)
The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object.
Specified by:
setLocale in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
Parameters:
loc - the locale of the response
See Also:
ServletResponse.getLocale()

getLocale

public java.util.LocalegetLocale()
The default behavior of this method is to return getLocale() on the wrapped response object.
Specified by:
getLocale in interfaceServletResponse
Following copied from interface:javax.servlet.ServletResponse
See Also:
ServletResponse.setLocale(java.util.Locale)

         


[8]ページ先頭

©2009-2025 Movatter.jp