org.apache.catalina.connector
Class ResponseBase

java.lang.Object
  extended byorg.apache.catalina.connector.ResponseBase
All Implemented Interfaces:
Response, javax.servlet.ServletResponse
Direct Known Subclasses:
HttpResponseBase

public abstract class ResponseBase
extends java.lang.Object
implements Response, javax.servlet.ServletResponse

Convenience base implementation of the Response interface, which can be used for the Response implementation required by most Connectors. Only the connector-specific methods need to be implemented.

Version:
$Revision: 1.27 $ $Date: 2004/08/26 21:30:19 $
Author:
Craig R. McClanahan, Remy Maucherat

Field Summary
protected  boolean appCommitted
          Deprecated. Has this response been committed by the application yet?
protected  byte[] buffer
          Deprecated. The buffer through which all of our output bytes are passed.
protected  int bufferCount
          Deprecated. The number of data bytes currently in the buffer.
protected  boolean committed
          Deprecated. Has this response been committed yet?
protected  Connector connector
          Deprecated. The Connector through which this Response is returned.
protected  int contentCount
          Deprecated. The actual number of bytes written to this Response.
protected  int contentLength
          Deprecated. The content length associated with this Response.
protected  java.lang.String contentType
          Deprecated. The content type associated with this Response.
protected  Context context
          Deprecated. The Context within which this Response is being produced.
protected  java.lang.String encoding
          Deprecated. The character encoding associated with this Response.
protected  boolean error
          Deprecated. Error flag.
protected  ResponseFacade facade
          Deprecated. The facade associated with this response.
protected  boolean included
          Deprecated. Are we currently processing inside a RequestDispatcher.include()?
protected static java.lang.String info
          Deprecated. Descriptive information about this Response implementation.
protected  java.util.Locale locale
          Deprecated. The Locale associated with this Response.
protected  java.io.OutputStream output
          Deprecated. The output stream associated with this Response.
protected  Request request
          Deprecated. The Request with which this Response is associated.
protected static StringManager sm
          Deprecated. The string manager for this package.
protected  javax.servlet.ServletOutputStream stream
          Deprecated. The ServletOutputStream that has been returned by getOutputStream(), if any.
protected  boolean suspended
          Deprecated. Has this response output been suspended?
protected  java.io.PrintWriter writer
          Deprecated. The PrintWriter that has been returned by getWriter(), if any.
 
Constructor Summary
ResponseBase()
          Deprecated.  
 
Method Summary
 javax.servlet.ServletOutputStream createOutputStream()
          Deprecated. Create and return a ServletOutputStream to write the content associated with this Response.
 void finishResponse()
          Deprecated. Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
 void flushBuffer()
          Deprecated. Flush the buffer and commit this response.
 int getBufferSize()
          Deprecated. Return the actual buffer size used for this Response.
 java.lang.String getCharacterEncoding()
          Deprecated. Return the character encoding used for this Response.
 Connector getConnector()
          Deprecated. Return the Connector through which this Response will be transmitted.
 int getContentCount()
          Deprecated. Return the number of bytes actually written to the output stream.
 int getContentLength()
          Deprecated. Return the content length that was set or calculated for this Response.
 java.lang.String getContentType()
          Deprecated. Return the content type that was set or calculated for this response, or null if no content type was set.
 Context getContext()
          Deprecated. Return the Context with which this Response is associated.
 boolean getIncluded()
          Deprecated. Return the "processing inside an include" flag.
 java.lang.String getInfo()
          Deprecated. Return descriptive information about this Response implementation and the corresponding version number, in the format <description>/<version>.
 java.util.Locale getLocale()
          Deprecated. Return the Locale assigned to this response.
 javax.servlet.ServletOutputStream getOutputStream()
          Deprecated. Return the servlet output stream associated with this Response.
 java.io.PrintWriter getReporter()
          Deprecated. Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has already been acquired.
 Request getRequest()
          Deprecated. Return the Request with which this Response is associated.
 javax.servlet.ServletResponse getResponse()
          Deprecated. Return the ServletResponse for which this object is the facade.
 java.io.OutputStream getStream()
          Deprecated. Return the output stream associated with this Response.
 java.io.PrintWriter getWriter()
          Deprecated. Return the writer associated with this Response.
 boolean isAppCommitted()
          Deprecated. Application commit flag accessor.
 boolean isCommitted()
          Deprecated. Has the output of this response already been committed?
 boolean isError()
          Deprecated. Error flag accessor.
 boolean isSuspended()
          Deprecated. Suspended flag accessor.
 void recycle()
          Deprecated. Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void reset()
          Deprecated. Clear any content written to the buffer.
 void resetBuffer()
          Deprecated. Reset the data buffer but not any status or header information.
 void setAppCommitted(boolean appCommitted)
          Deprecated. Set the application commit flag.
 void setBufferSize(int size)
          Deprecated. Set the buffer size to be used for this Response.
 void setConnector(Connector connector)
          Deprecated. Set the Connector through which this Response will be transmitted.
 void setContentLength(int length)
          Deprecated. Set the content length (in bytes) for this Response.
 void setContentType(java.lang.String type)
          Deprecated. Set the content type for this Response.
 void setContext(Context context)
          Deprecated. Set the Context with which this Response is associated.
 void setError()
          Deprecated. Set the error flag.
 void setIncluded(boolean included)
          Deprecated. Set the "processing inside an include" flag.
 void setLocale(java.util.Locale locale)
          Deprecated. Set the Locale that is appropriate for this response, including setting the appropriate character encoding.
 void setRequest(Request request)
          Deprecated. Set the Request with which this Response is associated.
 void setStream(java.io.OutputStream stream)
          Deprecated. Set the output stream associated with this Response.
 void setSuspended(boolean suspended)
          Deprecated. Set the suspended flag.
 void write(byte[] b)
          Deprecated. Write b.length bytes from the specified byte array to our output stream.
 void write(byte[] b, int off, int len)
          Deprecated. Write len bytes from the specified byte array, starting at the specified offset, to our output stream.
 void write(int b)
          Deprecated. Write the specified byte to our output stream, flushing if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Response
sendAcknowledgement
 

Field Detail

appCommitted

protected boolean appCommitted
Deprecated. 
Has this response been committed by the application yet?


buffer

protected byte[] buffer
Deprecated. 
The buffer through which all of our output bytes are passed.


bufferCount

protected int bufferCount
Deprecated. 
The number of data bytes currently in the buffer.


committed

protected boolean committed
Deprecated. 
Has this response been committed yet?


connector

protected Connector connector
Deprecated. 
The Connector through which this Response is returned.


contentCount

protected int contentCount
Deprecated. 
The actual number of bytes written to this Response.


contentLength

protected int contentLength
Deprecated. 
The content length associated with this Response.


contentType

protected java.lang.String contentType
Deprecated. 
The content type associated with this Response.


context

protected Context context
Deprecated. 
The Context within which this Response is being produced.


encoding

protected java.lang.String encoding
Deprecated. 
The character encoding associated with this Response.


facade

protected ResponseFacade facade
Deprecated. 
The facade associated with this response.


included

protected boolean included
Deprecated. 
Are we currently processing inside a RequestDispatcher.include()?


info

protected static final java.lang.String info
Deprecated. 
Descriptive information about this Response implementation.

See Also:
Constant Field Values

locale

protected java.util.Locale locale
Deprecated. 
The Locale associated with this Response.


output

protected java.io.OutputStream output
Deprecated. 
The output stream associated with this Response.


request

protected Request request
Deprecated. 
The Request with which this Response is associated.


sm

protected static StringManager sm
Deprecated. 
The string manager for this package.


stream

protected javax.servlet.ServletOutputStream stream
Deprecated. 
The ServletOutputStream that has been returned by getOutputStream(), if any.


suspended

protected boolean suspended
Deprecated. 
Has this response output been suspended?


writer

protected java.io.PrintWriter writer
Deprecated. 
The PrintWriter that has been returned by getWriter(), if any.


error

protected boolean error
Deprecated. 
Error flag. True if the response is an error report.

Constructor Detail

ResponseBase

public ResponseBase()
Deprecated. 
Method Detail

setAppCommitted

public void setAppCommitted(boolean appCommitted)
Deprecated. 
Set the application commit flag.

Specified by:
setAppCommitted in interface Response
Parameters:
appCommitted - The new application committed flag value

isAppCommitted

public boolean isAppCommitted()
Deprecated. 
Application commit flag accessor.

Specified by:
isAppCommitted in interface Response

getConnector

public Connector getConnector()
Deprecated. 
Return the Connector through which this Response will be transmitted.

Specified by:
getConnector in interface Response

setConnector

public void setConnector(Connector connector)
Deprecated. 
Set the Connector through which this Response will be transmitted.

Specified by:
setConnector in interface Response
Parameters:
connector - The new connector

getContentCount

public int getContentCount()
Deprecated. 
Return the number of bytes actually written to the output stream.

Specified by:
getContentCount in interface Response

getContext

public Context getContext()
Deprecated. 
Return the Context with which this Response is associated.

Specified by:
getContext in interface Response

setContext

public void setContext(Context context)
Deprecated. 
Set the Context with which this Response is associated. This should be called as soon as the appropriate Context is identified.

Specified by:
setContext in interface Response
Parameters:
context - The associated Context

getIncluded

public boolean getIncluded()
Deprecated. 
Return the "processing inside an include" flag.

Specified by:
getIncluded in interface Response

setIncluded

public void setIncluded(boolean included)
Deprecated. 
Set the "processing inside an include" flag.

Specified by:
setIncluded in interface Response
Parameters:
included - true if we are currently inside a RequestDispatcher.include(), else false

getInfo

public java.lang.String getInfo()
Deprecated. 
Return descriptive information about this Response implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Response

getRequest

public Request getRequest()
Deprecated. 
Return the Request with which this Response is associated.

Specified by:
getRequest in interface Response

setRequest

public void setRequest(Request request)
Deprecated. 
Set the Request with which this Response is associated.

Specified by:
setRequest in interface Response
Parameters:
request - The new associated request

getResponse

public javax.servlet.ServletResponse getResponse()
Deprecated. 
Return the ServletResponse for which this object is the facade.

Specified by:
getResponse in interface Response

getStream

public java.io.OutputStream getStream()
Deprecated. 
Return the output stream associated with this Response.

Specified by:
getStream in interface Response

setStream

public void setStream(java.io.OutputStream stream)
Deprecated. 
Set the output stream associated with this Response.

Specified by:
setStream in interface Response
Parameters:
stream - The new output stream

setSuspended

public void setSuspended(boolean suspended)
Deprecated. 
Set the suspended flag.

Specified by:
setSuspended in interface Response
Parameters:
suspended - The new suspended flag value

isSuspended

public boolean isSuspended()
Deprecated. 
Suspended flag accessor.

Specified by:
isSuspended in interface Response

setError

public void setError()
Deprecated. 
Set the error flag.

Specified by:
setError in interface Response

isError

public boolean isError()
Deprecated. 
Error flag accessor.

Specified by:
isError in interface Response

createOutputStream

public javax.servlet.ServletOutputStream createOutputStream()
                                                     throws java.io.IOException
Deprecated. 
Create and return a ServletOutputStream to write the content associated with this Response.

Specified by:
createOutputStream in interface Response
Throws:
java.io.IOException - if an input/output error occurs

finishResponse

public void finishResponse()
                    throws java.io.IOException
Deprecated. 
Perform whatever actions are required to flush and close the output stream or writer, in a single operation.

Specified by:
finishResponse in interface Response
Throws:
java.io.IOException - if an input/output error occurs

getContentLength

public int getContentLength()
Deprecated. 
Return the content length that was set or calculated for this Response.

Specified by:
getContentLength in interface Response

getContentType

public java.lang.String getContentType()
Deprecated. 
Return the content type that was set or calculated for this response, or null if no content type was set.

Specified by:
getContentType in interface Response

getReporter

public java.io.PrintWriter getReporter()
Deprecated. 
Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has already been acquired.

Specified by:
getReporter in interface Response
Returns:
Writer which can be used for error reports. If the response is not an error report returned using sendError or triggered by an unexpected exception thrown during the servlet processing (and only in that case), null will be returned if the response stream has already been used.

recycle

public void recycle()
Deprecated. 
Release all object references, and initialize instance variables, in preparation for reuse of this object.

Specified by:
recycle in interface Response

write

public void write(int b)
           throws java.io.IOException
Deprecated. 
Write the specified byte to our output stream, flushing if necessary.

Parameters:
b - The byte to be written
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(byte[] b)
           throws java.io.IOException
Deprecated. 
Write b.length bytes from the specified byte array to our output stream. Flush the output stream as necessary.

Parameters:
b - The byte array to be written
Throws:
java.io.IOException - if an input/output error occurs

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Deprecated. 
Write len bytes from the specified byte array, starting at the specified offset, to our output stream. Flush the output stream as necessary.

Parameters:
b - The byte array containing the bytes to be written
off - Zero-relative starting offset of the bytes to be written
len - The number of bytes to be written
Throws:
java.io.IOException - if an input/output error occurs

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Deprecated. 
Flush the buffer and commit this response.

Specified by:
flushBuffer in interface javax.servlet.ServletResponse
Throws:
java.io.IOException - if an input/output error occurs

getBufferSize

public int getBufferSize()
Deprecated. 
Return the actual buffer size used for this Response.

Specified by:
getBufferSize in interface javax.servlet.ServletResponse

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Deprecated. 
Return the character encoding used for this Response.

Specified by:
getCharacterEncoding in interface javax.servlet.ServletResponse

getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
                                                  throws java.io.IOException
Deprecated. 
Return the servlet output stream associated with this Response.

Specified by:
getOutputStream in interface javax.servlet.ServletResponse
Throws:
java.lang.IllegalStateException - if getWriter has already been called for this response
java.io.IOException - if an input/output error occurs

getLocale

public java.util.Locale getLocale()
Deprecated. 
Return the Locale assigned to this response.

Specified by:
getLocale in interface javax.servlet.ServletResponse

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Deprecated. 
Return the writer associated with this Response.

Specified by:
getWriter in interface javax.servlet.ServletResponse
Throws:
java.lang.IllegalStateException - if getOutputStream has already been called for this response
java.io.IOException - if an input/output error occurs

isCommitted

public boolean isCommitted()
Deprecated. 
Has the output of this response already been committed?

Specified by:
isCommitted in interface javax.servlet.ServletResponse

reset

public void reset()
Deprecated. 
Clear any content written to the buffer.

Specified by:
reset in interface javax.servlet.ServletResponse
Throws:
java.lang.IllegalStateException - if this response has already been committed

resetBuffer

public void resetBuffer()
Deprecated. 
Reset the data buffer but not any status or header information.

Specified by:
resetBuffer in interface Response
Throws:
java.lang.IllegalStateException - if the response has already been committed

setBufferSize

public void setBufferSize(int size)
Deprecated. 
Set the buffer size to be used for this Response.

Specified by:
setBufferSize in interface javax.servlet.ServletResponse
Parameters:
size - The new buffer size
Throws:
java.lang.IllegalStateException - if this method is called after output has been committed for this response

setContentLength

public void setContentLength(int length)
Deprecated. 
Set the content length (in bytes) for this Response.

Specified by:
setContentLength in interface javax.servlet.ServletResponse
Parameters:
length - The new content length

setContentType

public void setContentType(java.lang.String type)
Deprecated. 
Set the content type for this Response.

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

setLocale

public void setLocale(java.util.Locale locale)
Deprecated. 
Set the Locale that is appropriate for this response, including setting the appropriate character encoding.

Specified by:
setLocale in interface javax.servlet.ServletResponse
Parameters:
locale - The new locale


Copyright 2000-2002 Apache Software Foundation. All Rights Reserved.