net.sf.ehcache.constructs.web

Class GenericResponseWrapper

public class GenericResponseWrapper extends HttpServletResponseWrapper implements Serializable

Provides a wrapper for javax.servlet.http.HttpServletResponseWrapper.

It is used to wrap the real Response so that we can modify it after that the target of the request has delivered its response.

It uses the Wrapper pattern.

Version: $Id: GenericResponseWrapper.java 80 2006-05-14 03:16:22Z gregluck $

Author: Greg Luck

Constructor Summary
GenericResponseWrapper(HttpServletResponse response, OutputStream outstr)
Creates a GenericResponseWrapper
Method Summary
voidaddCookie(Cookie cookie)
Adds a cookie.
voidaddHeader(String name, String value)
Adds a header.
StringencodeRedirectUrl(String s)
Override the deprecated method and call non-deprecated method
StringencodeUrl(String s)
Override the deprecated method and call non-deprecated method
voidflush()
Flushes all the streams for this response.
voidflushBuffer()
Flushes buffer and commits response to client.
intgetContentLength()
Gets the content length.
StringgetContentType()
Gets the content type.
CollectiongetCookies()
Gets all the cookies.
CollectiongetHeaders()
Gets the headers.
ServletOutputStreamgetOutputStream()
Gets the outputstream.
intgetStatus()
Returns the status code for this response.
PrintWritergetWriter()
Gets the print writer.
voidreset()
Resets the response.
voidresetBuffer()
Resets the buffers.
voidsetContentLength(int length)
Sets the content length.
voidsetContentType(String type)
Sets the content type.
voidsetHeader(String name, String value)
voidsetStatus(int code)
Sets the status code for this response.
voidsetStatus(int code, String msg)
Sets the status code for this response.

Constructor Detail

GenericResponseWrapper

public GenericResponseWrapper(HttpServletResponse response, OutputStream outstr)
Creates a GenericResponseWrapper

Method Detail

addCookie

public void addCookie(Cookie cookie)
Adds a cookie.

addHeader

public void addHeader(String name, String value)
Adds a header.

encodeRedirectUrl

public String encodeRedirectUrl(String s)
Override the deprecated method and call non-deprecated method

encodeUrl

public String encodeUrl(String s)
Override the deprecated method and call non-deprecated method

flush

public void flush()
Flushes all the streams for this response.

flushBuffer

public void flushBuffer()
Flushes buffer and commits response to client.

getContentLength

public int getContentLength()
Gets the content length.

getContentType

public String getContentType()
Gets the content type.

getCookies

public Collection getCookies()
Gets all the cookies.

getHeaders

public Collection getHeaders()
Gets the headers.

getOutputStream

public ServletOutputStream getOutputStream()
Gets the outputstream.

getStatus

public int getStatus()
Returns the status code for this response.

getWriter

public PrintWriter getWriter()
Gets the print writer.

reset

public void reset()
Resets the response.

resetBuffer

public void resetBuffer()
Resets the buffers.

setContentLength

public void setContentLength(int length)
Sets the content length.

setContentType

public void setContentType(String type)
Sets the content type.

setHeader

public void setHeader(String name, String value)

See Also: GenericResponseWrapper

setStatus

public void setStatus(int code)
Sets the status code for this response.

setStatus

public void setStatus(int code, String msg)
Sets the status code for this response.