org.apache.catalina.ssi

Class ResponseIncludeWrapper

public class ResponseIncludeWrapper extends HttpServletResponseWrapper

A HttpServletResponseWrapper, used from SSIServletExternalResolver

Version: $Revision: 708160 $, $Date: 2008-10-27 13:56:37 +0100 (Mon, 27 Oct 2008) $

Author: Bip Thelin David Becker

Field Summary
protected ServletOutputStreamcaptureServletOutputStream
Our ServletOutputStream
protected longlastModified
protected PrintWriterprintWriter
protected ServletOutputStreamservletOutputStream
Constructor Summary
ResponseIncludeWrapper(ServletContext context, HttpServletRequest request, HttpServletResponse response, ServletOutputStream captureServletOutputStream)
Initialize our wrapper with the current HttpServletResponse and ServletOutputStream.
Method Summary
voidaddDateHeader(String name, long value)
voidaddHeader(String name, String value)
voidflushOutputStreamOrWriter()
Flush the servletOutputStream or printWriter ( only one will be non-null ) This must be called after a requestDispatcher.include, since we can't assume that the included servlet flushed its stream.
StringgetContentType()
Returns the value of the content-type header field.
longgetLastModified()
Returns the value of the last-modified header field.
ServletOutputStreamgetOutputStream()
Return a OutputStream, throws and exception if a printwriter already been returned.
PrintWritergetWriter()
Return a printwriter, throws and exception if a OutputStream already been returned.
voidsetContentType(String mime)
Sets the value of the content-type header field.
voidsetDateHeader(String name, long value)
voidsetHeader(String name, String value)
voidsetLastModified(long lastModified)
Sets the value of the last-modified header field.

Field Detail

captureServletOutputStream

protected ServletOutputStream captureServletOutputStream
Our ServletOutputStream

lastModified

protected long lastModified

printWriter

protected PrintWriter printWriter

servletOutputStream

protected ServletOutputStream servletOutputStream

Constructor Detail

ResponseIncludeWrapper

public ResponseIncludeWrapper(ServletContext context, HttpServletRequest request, HttpServletResponse response, ServletOutputStream captureServletOutputStream)
Initialize our wrapper with the current HttpServletResponse and ServletOutputStream.

Parameters: context The servlet context request The HttpServletResponse to use response The response to use captureServletOutputStream The ServletOutputStream to use

Method Detail

addDateHeader

public void addDateHeader(String name, long value)

addHeader

public void addHeader(String name, String value)

flushOutputStreamOrWriter

public void flushOutputStreamOrWriter()
Flush the servletOutputStream or printWriter ( only one will be non-null ) This must be called after a requestDispatcher.include, since we can't assume that the included servlet flushed its stream.

getContentType

public String getContentType()
Returns the value of the content-type header field.

Returns: the content type of the resource referenced by this ResponseIncludeWrapper, or null if not known.

getLastModified

public long getLastModified()
Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT.

Returns: the date the resource referenced by this ResponseIncludeWrapper was last modified, or -1 if not known.

getOutputStream

public ServletOutputStream getOutputStream()
Return a OutputStream, throws and exception if a printwriter already been returned.

Returns: a OutputStream object

Throws: java.io.IOException if the printwriter already been called

getWriter

public PrintWriter getWriter()
Return a printwriter, throws and exception if a OutputStream already been returned.

Returns: a PrintWriter object

Throws: java.io.IOException if the outputstream already been called

setContentType

public void setContentType(String mime)
Sets the value of the content-type header field.

Parameters: mime a mime type

setDateHeader

public void setDateHeader(String name, long value)

setHeader

public void setHeader(String name, String value)

setLastModified

public void setLastModified(long lastModified)
Sets the value of the last-modified header field.

Parameters: lastModified The number of milliseconds since January 1, 1970 GMT.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.