org.apache.tomcat.core
Class Response

java.lang.Object
  extended byorg.apache.tomcat.core.Response
Direct Known Subclasses:
JNIResponseAdapter

public class Response
extends java.lang.Object

Author:
James Duncan Davidson [duncan@eng.sun.com], Jason Hunter [jch@eng.sun.com], James Todd [gonzo@eng.sun.com], Harish Prabandham, Hans Bergsten

Field Summary
protected  java.lang.String characterEncoding
           
protected  boolean commited
           
protected  java.lang.String contentLanguage
           
protected  java.lang.String contentType
           
static java.lang.String DEFAULT_CHAR_ENCODING
           
static java.lang.String DEFAULT_CONTENT_TYPE
           
static java.util.Locale DEFAULT_LOCALE
           
protected  java.lang.Exception errorException
           
protected  java.lang.String errorURI
           
protected  MimeHeaders headers
           
protected  boolean included
           
protected  java.util.Locale locale
           
static java.lang.String LOCALE_DEFAULT
           
protected  OutputBuffer oBuffer
           
protected  Request request
           
protected  java.lang.Object responseFacade
           
protected static StringManager sm
           
protected  int status
           
protected  boolean usingStream
           
protected  boolean usingWriter
           
 
Constructor Summary
Response()
           
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String value)
           
 boolean containsHeader(java.lang.String name)
           
 void doWrite(byte[] buffer, int pos, int count)
          Write a chunk of bytes.
 void endHeaders()
          Signal that we're done with the headers, and body will follow.
 void finish()
           
 void flushBuffer()
           
 OutputBuffer getBuffer()
           
 int getBufferSize()
           
 java.lang.String getCharacterEncoding()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.lang.Exception getErrorException()
          Get the Exception that occurred during request processing.
 java.lang.String getErrorURI()
          Get the request URI that caused the original error.
 java.lang.Object getFacade()
           
 java.util.Locale getLocale()
           
 MimeHeaders getMimeHeaders()
           
 Request getRequest()
           
 int getStatus()
           
protected  void init()
          Init is called from CM when the object is added to tomcat.
 boolean isBufferCommitted()
           
 boolean isExceptionPresent()
           
 boolean isIncluded()
           
 boolean isUsingStream()
           
 boolean isUsingWriter()
           
 void notifyEndHeaders()
          Signal that we're done with the headers, and body will follow.
 void recycle()
           
 void reset()
           
 void resetBuffer()
           
 void setBufferCommitted(boolean v)
           
 void setBufferSize(int size)
           
 void setContentLength(int contentLength)
           
 void setContentType(java.lang.String contentType)
           
 void setErrorException(java.lang.Exception ex)
          Set the error Exception that occurred during request processing.
 void setErrorURI(java.lang.String uri)
          Set request URI that caused an error during request processing.
 void setFacade(java.lang.Object facade)
          Higher-level layer
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setIncluded(boolean incl)
           
 void setLocale(java.util.Locale locale)
          Called explicitely by user to set the Content-Language and the default encoding
 void setRequest(Request request)
          Associated request
 void setStatus(int status)
          Set the response status
 void setUsingStream(boolean stream)
           
 void setUsingWriter(boolean writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTENT_TYPE

public static final java.lang.String DEFAULT_CONTENT_TYPE
See Also:
Constant Field Values

DEFAULT_CHAR_ENCODING

public static final java.lang.String DEFAULT_CHAR_ENCODING
See Also:
Constant Field Values

LOCALE_DEFAULT

public static final java.lang.String LOCALE_DEFAULT
See Also:
Constant Field Values

DEFAULT_LOCALE

public static final java.util.Locale DEFAULT_LOCALE

sm

protected static StringManager sm

request

protected Request request

responseFacade

protected java.lang.Object responseFacade

status

protected int status

headers

protected MimeHeaders headers

oBuffer

protected OutputBuffer oBuffer

commited

protected boolean commited

usingStream

protected boolean usingStream

usingWriter

protected boolean usingWriter

included

protected boolean included

errorException

protected java.lang.Exception errorException

errorURI

protected java.lang.String errorURI

contentType

protected java.lang.String contentType

contentLanguage

protected java.lang.String contentLanguage

characterEncoding

protected java.lang.String characterEncoding

locale

protected java.util.Locale locale
Constructor Detail

Response

public Response()
Method Detail

init

protected void init()
Init is called from CM when the object is added to tomcat.


getFacade

public java.lang.Object getFacade()

setFacade

public void setFacade(java.lang.Object facade)
Higher-level layer


setRequest

public void setRequest(Request request)
Associated request


getRequest

public Request getRequest()

getBuffer

public OutputBuffer getBuffer()

getMimeHeaders

public MimeHeaders getMimeHeaders()

isIncluded

public boolean isIncluded()

setIncluded

public void setIncluded(boolean incl)

getStatus

public int getStatus()

setStatus

public void setStatus(int status)
Set the response status


isUsingStream

public boolean isUsingStream()

setUsingStream

public void setUsingStream(boolean stream)

isUsingWriter

public boolean isUsingWriter()

setUsingWriter

public void setUsingWriter(boolean writer)

isBufferCommitted

public boolean isBufferCommitted()

setBufferCommitted

public void setBufferCommitted(boolean v)

setErrorException

public void setErrorException(java.lang.Exception ex)
Set the error Exception that occurred during request processing.


getErrorException

public java.lang.Exception getErrorException()
Get the Exception that occurred during request processing.


isExceptionPresent

public boolean isExceptionPresent()

setErrorURI

public void setErrorURI(java.lang.String uri)
Set request URI that caused an error during request processing.


getErrorURI

public java.lang.String getErrorURI()
Get the request URI that caused the original error.


reset

public void reset()
           throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

finish

public void finish()
            throws java.io.IOException
Throws:
java.io.IOException

containsHeader

public boolean containsHeader(java.lang.String name)

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)

endHeaders

public void endHeaders()
                throws java.io.IOException
Signal that we're done with the headers, and body will follow. Any implementation needs to notify ContextManager, to allow interceptors to fix headers.

Throws:
java.io.IOException

notifyEndHeaders

public void notifyEndHeaders()
                      throws java.io.IOException
Signal that we're done with the headers, and body will follow. Any implementation needs to notify ContextManager, to allow interceptors to fix headers. Note: This can be called during an included request.

Throws:
java.io.IOException

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int size)
                   throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

resetBuffer

public void resetBuffer()
                 throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Throws:
java.io.IOException

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(java.util.Locale locale)
Called explicitely by user to set the Content-Language and the default encoding


getCharacterEncoding

public java.lang.String getCharacterEncoding()

setContentType

public void setContentType(java.lang.String contentType)

getContentType

public java.lang.String getContentType()

setContentLength

public void setContentLength(int contentLength)

getContentLength

public int getContentLength()

doWrite

public void doWrite(byte[] buffer,
                    int pos,
                    int count)
             throws java.io.IOException
Write a chunk of bytes. Should be called only from ServletOutputStream implementations, No need to implement it if your adapter implements ServletOutputStream. Headers and status will be written before this method is exceuted.

Throws:
java.io.IOException

recycle

public void recycle()


Copyright © 2001 Apache Software Foundation. All Rights Reserved.