javax.servlet

Class ServletResponseWrapper

public class ServletResponseWrapper extends Object implements ServletResponse

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

Version: $Version$

Author: Various

See Also:

Constructor Summary
ServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object.
Method Summary
voidflushBuffer()
The default behavior of this method is to call flushBuffer() on the wrapped response object.
intgetBufferSize()
The default behavior of this method is to return getBufferSize() on the wrapped response object.
StringgetCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped response object.
StringgetContentType()
The default behavior of this method is to return getContentType() on the wrapped response object.
LocalegetLocale()
The default behavior of this method is to return getLocale() on the wrapped response object.
ServletOutputStreamgetOutputStream()
The default behavior of this method is to return getOutputStream() on the wrapped response object.
ServletResponsegetResponse()
Return the wrapped ServletResponse object.
PrintWritergetWriter()
The default behavior of this method is to return getWriter() on the wrapped response object.
booleanisCommitted()
The default behavior of this method is to return isCommitted() on the wrapped response object.
voidreset()
The default behavior of this method is to call reset() on the wrapped response object.
voidresetBuffer()
The default behavior of this method is to call resetBuffer() on the wrapped response object.
voidsetBufferSize(int size)
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object.
voidsetCharacterEncoding(String charset)
The default behavior of this method is to call setCharacterEncoding(String charset) on the wrapped response object.
voidsetContentLength(int len)
The default behavior of this method is to call setContentLength(int len) on the wrapped response object.
voidsetContentType(String type)
The default behavior of this method is to call setContentType(String type) on the wrapped response object.
voidsetLocale(Locale loc)
The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object.
voidsetResponse(ServletResponse response)
Sets the response being wrapped.

Constructor Detail

ServletResponseWrapper

public ServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object.

Throws: java.lang.IllegalArgumentException if the response is null.

Method Detail

flushBuffer

public void flushBuffer()
The default behavior of this method is to call flushBuffer() on the wrapped response object.

getBufferSize

public int getBufferSize()
The default behavior of this method is to return getBufferSize() on the wrapped response object.

getCharacterEncoding

public String getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped response object.

getContentType

public String getContentType()
The default behavior of this method is to return getContentType() on the wrapped response object.

Since: 2.4

getLocale

public Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped response object.

getOutputStream

public ServletOutputStream getOutputStream()
The default behavior of this method is to return getOutputStream() on the wrapped response object.

getResponse

public ServletResponse getResponse()
Return the wrapped ServletResponse object.

getWriter

public PrintWriter getWriter()
The default behavior of this method is to return getWriter() on the wrapped response object.

isCommitted

public boolean isCommitted()
The default behavior of this method is to return isCommitted() on the wrapped response object.

reset

public void reset()
The default behavior of this method is to call reset() on the wrapped response object.

resetBuffer

public void resetBuffer()
The default behavior of this method is to call resetBuffer() on the wrapped response object.

setBufferSize

public void setBufferSize(int size)
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object.

setCharacterEncoding

public void setCharacterEncoding(String charset)
The default behavior of this method is to call setCharacterEncoding(String charset) on the wrapped response object.

Since: 2.4

setContentLength

public void setContentLength(int len)
The default behavior of this method is to call setContentLength(int len) on the wrapped response object.

setContentType

public void setContentType(String type)
The default behavior of this method is to call setContentType(String type) on the wrapped response object.

setLocale

public void setLocale(Locale loc)
The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object.

setResponse

public void setResponse(ServletResponse response)
Sets the response being wrapped.

Throws: java.lang.IllegalArgumentException if the response is null.

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.