org.apache.commons.workflow.web
Class IncludeResponse23

java.lang.Object
  extended by javax.servlet.ServletResponseWrapper
      extended by org.apache.commons.workflow.web.IncludeResponse23
All Implemented Interfaces:
javax.servlet.ServletResponse

public class IncludeResponse23
extends javax.servlet.ServletResponseWrapper

Implementation of HttpServletResponseWrapper for use in IncludeStep23. It buffers the response characters up into a memory-resident buffer that can be converted into a String by calling getContent().

Version:
$Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan

Field Summary
protected  ByteArrayOutputStream baos
          Accumulator for output that is generated via getOutputStream().
protected  CharArrayWriter caw
          Accumulator for output that is generated via getWriter().
 
Constructor Summary
IncludeResponse23(javax.servlet.ServletResponse response)
          Construct a new response wrapper according to the specified parameters.
 
Method Summary
 void flushBuffer()
          Swallow any attempt to flush the response buffer.
 String getCharacterEncoding()
          Return the character encoding for the included response (if any).
 String getContent()
          Return the response data written to this response as a String.
 javax.servlet.ServletOutputStream getOutputStream()
          Return a ServletOutputStream that can be used to accumulate the response data for the included resource.
 PrintWriter getWriter()
          Return a PrintWriter that can be used to accumulate the response data for the included resource.
 void reset()
          Reset the response buffer and all headers.
 void resetBuffer()
          Reset the response buffer to contain no data.
 void setContentType(String contentType)
          Set the content type (and possibly the character encoding) of the response data.
 
Methods inherited from class javax.servlet.ServletResponseWrapper
getBufferSize, getLocale, getResponse, isCommitted, setBufferSize, setContentLength, setLocale, setResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baos

protected ByteArrayOutputStream baos
Accumulator for output that is generated via getOutputStream().


caw

protected CharArrayWriter caw
Accumulator for output that is generated via getWriter().

Constructor Detail

IncludeResponse23

public IncludeResponse23(javax.servlet.ServletResponse response)
Construct a new response wrapper according to the specified parameters.

Parameters:
response - The servlet response we are wrapping
Method Detail

flushBuffer

public void flushBuffer()
                 throws IOException
Swallow any attempt to flush the response buffer.

Specified by:
flushBuffer in interface javax.servlet.ServletResponse
Overrides:
flushBuffer in class javax.servlet.ServletResponseWrapper
Throws:
IOException

getCharacterEncoding

public String getCharacterEncoding()
Return the character encoding for the included response (if any).

Specified by:
getCharacterEncoding in interface javax.servlet.ServletResponse
Overrides:
getCharacterEncoding in class javax.servlet.ServletResponseWrapper

getContent

public String getContent()
                  throws IOException
Return the response data written to this response as a String.

Throws:
IOException - if a conversion error occurs

getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
                                                  throws IOException
Return a ServletOutputStream that can be used to accumulate the response data for the included resource.

Specified by:
getOutputStream in interface javax.servlet.ServletResponse
Overrides:
getOutputStream in class javax.servlet.ServletResponseWrapper
Throws:
IOException - if an I/O error occurs

getWriter

public PrintWriter getWriter()
                      throws IOException
Return a PrintWriter that can be used to accumulate the response data for the included resource.

Specified by:
getWriter in interface javax.servlet.ServletResponse
Overrides:
getWriter in class javax.servlet.ServletResponseWrapper
Throws:
IOException - if an I/O error occurs

reset

public void reset()
Reset the response buffer and all headers.

Specified by:
reset in interface javax.servlet.ServletResponse
Overrides:
reset in class javax.servlet.ServletResponseWrapper

resetBuffer

public void resetBuffer()
Reset the response buffer to contain no data.

Specified by:
resetBuffer in interface javax.servlet.ServletResponse
Overrides:
resetBuffer in class javax.servlet.ServletResponseWrapper

setContentType

public void setContentType(String contentType)
Set the content type (and possibly the character encoding) of the response data.

Specified by:
setContentType in interface javax.servlet.ServletResponse
Overrides:
setContentType in class javax.servlet.ServletResponseWrapper
Parameters:
contentType - The new content type


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.