Save This Page
Home » apache-tomcat-6.0.26-src » org.apache » catalina » connector » [javadoc | source]
org.apache.catalina.connector
public class: Response [javadoc | source]
java.lang.Object
   org.apache.catalina.connector.Response

All Implemented Interfaces:
    HttpServletResponse

Wrapper object for the Coyote response.
Field Summary
protected static final  String info    Descriptive information about this Response implementation. 
protected static  StringManager sm    The string manager for this package. 
protected  SimpleDateFormat format    The date format we will use for creating date headers. 
protected  Connector connector    Associated Catalina connector. 
protected  Response coyoteResponse    Coyote response. 
protected  OutputBuffer outputBuffer    The associated output buffer. 
protected  CoyoteOutputStream outputStream    The associated output stream. 
protected  CoyoteWriter writer    The associated writer. 
protected  boolean appCommitted    The application commit flag. 
protected  boolean included    The included flag. 
protected  boolean error    The error flag. 
protected  ArrayList cookies    The set of Cookies associated with this Response. 
protected  boolean usingOutputStream    Using output stream flag. 
protected  boolean usingWriter    Using writer flag. 
protected  UEncoder urlEncoder    URL encoder. 
protected  CharChunk redirectURLCC    Recyclable buffer to hold the redirect URL. 
protected  Request request    The request with which this response is associated. 
protected  ResponseFacade facade    The facade associated with this response. 
Constructor:
 public Response() 
Method from org.apache.catalina.connector.Response Summary:
addCookie,   addCookieInternal,   addCookieInternal,   addDateHeader,   addHeader,   addIntHeader,   clearEncoders,   containsHeader,   createOutputStream,   encodeRedirectURL,   encodeRedirectUrl,   encodeURL,   encodeUrl,   finishResponse,   flushBuffer,   getBufferSize,   getCharacterEncoding,   getConnector,   getContentCount,   getContentCountLong,   getContentLength,   getContentType,   getContext,   getCookies,   getCoyoteResponse,   getHeader,   getHeaderNames,   getHeaderValues,   getIncluded,   getInfo,   getLocale,   getMessage,   getOutputStream,   getReporter,   getRequest,   getResponse,   getStatus,   getStream,   getWriter,   isAppCommitted,   isClosed,   isCommitted,   isEncodeable,   isError,   isSuspended,   recycle,   reset,   reset,   resetBuffer,   resetBuffer,   sendAcknowledgement,   sendError,   sendError,   sendRedirect,   setAppCommitted,   setBufferSize,   setCharacterEncoding,   setConnector,   setContentLength,   setContentType,   setContext,   setCoyoteResponse,   setDateHeader,   setError,   setHeader,   setIncluded,   setIntHeader,   setLocale,   setRequest,   setStatus,   setStatus,   setStream,   setSuspended,   toEncoded
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.connector.Response Detail:
 public  void addCookie(Cookie cookie) 
    Add the specified Cookie to those that will be included with this Response.
 public  void addCookieInternal(Cookie cookie) 
    Add the specified Cookie to those that will be included with this Response.
 public  void addCookieInternal(Cookie cookie,
    boolean httpOnly) 
    Add the specified Cookie to those that will be included with this Response.
 public  void addDateHeader(String name,
    long value) 
    Add the specified date header to the specified value.
 public  void addHeader(String name,
    String value) 
    Add the specified header to the specified value.
 public  void addIntHeader(String name,
    int value) 
    Add the specified integer header to the specified value.
 public  void clearEncoders() 
    Clear cached encoders (to save memory for Comet requests).
 public boolean containsHeader(String name) 
    Has the specified header been set already in this response?
 public ServletOutputStream createOutputStream() throws IOException 
    Create and return a ServletOutputStream to write the content associated with this Response.
 public String encodeRedirectURL(String url) 
    Encode the session identifier associated with this response into the specified redirect URL, if necessary.
 public String encodeRedirectUrl(String url) 
Deprecated! As - of Version 2.1 of the Java Servlet API, use encodeRedirectURL() instead.

    Encode the session identifier associated with this response into the specified redirect URL, if necessary.
 public String encodeURL(String url) 
    Encode the session identifier associated with this response into the specified URL, if necessary.
 public String encodeUrl(String url) 
Deprecated! As - of Version 2.1 of the Java Servlet API, use encodeURL() instead.

    Encode the session identifier associated with this response into the specified URL, if necessary.
 public  void finishResponse() throws IOException 
    Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
 public  void flushBuffer() throws IOException 
    Flush the buffer and commit this response.
 public int getBufferSize() 
    Return the actual buffer size used for this Response.
 public String getCharacterEncoding() 
    Return the character encoding used for this Response.
 public Connector getConnector() 
    Return the Connector through which this Request was received.
 public int getContentCount() 
    Return the number of bytes actually written to the output stream.
 public long getContentCountLong() 
    Return the number of bytes actually written to the output stream.
 public int getContentLength() 
    Return the content length that was set or calculated for this Response.
 public String getContentType() 
    Return the content type that was set or calculated for this response, or null if no content type was set.
 public Context getContext() 
    Return the Context within which this Request is being processed.
 public Cookie[] getCookies() 
    Return an array of all cookies set for this response, or a zero-length array if no cookies have been set.
 public Response getCoyoteResponse() 
    Get the Coyote response.
 public String getHeader(String name) 
    Return the value for the specified header, or null if this header has not been set. If more than one value was added for this name, only the first is returned; use getHeaderValues() to retrieve all of them.
 public String[] getHeaderNames() 
    Return an array of all the header names set for this response, or a zero-length array if no headers have been set.
 public String[] getHeaderValues(String name) 
    Return an array of all the header values associated with the specified header name, or an zero-length array if there are no such header values.
 public boolean getIncluded() 
    Return the "processing inside an include" flag.
 public String getInfo() 
    Return descriptive information about this Response implementation and the corresponding version number, in the format <description>/<version>.
 public Locale getLocale() 
    Return the Locale assigned to this response.
 public String getMessage() 
    Return the error message that was set with sendError() for this Response.
 public ServletOutputStream getOutputStream() throws IOException 
    Return the servlet output stream associated with this Response.
 public PrintWriter getReporter() throws IOException 
    Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has already been acquired.
 public Request getRequest() 
    Return the Request with which this Response is associated.
 public HttpServletResponse getResponse() 
    Return the ServletResponse for which this object is the facade.
 public int getStatus() 
    Return the HTTP status code associated with this Response.
 public OutputStream getStream() 
    Return the output stream associated with this Response.
 public PrintWriter getWriter() throws IOException 
    Return the writer associated with this Response.
 public boolean isAppCommitted() 
    Application commit flag accessor.
 public boolean isClosed() 
    Closed flag accessor.
 public boolean isCommitted() 
    Has the output of this response already been committed?
 protected boolean isEncodeable(String location) 
    Return true if the specified URL should be encoded with a session identifier. This will be true if all of the following conditions are met:
    • The request we are responding to asked for a valid session
    • The requested session ID was not received via a cookie
    • The specified URL points back to somewhere within the web application that is responding to this request
 public boolean isError() 
    Error flag accessor.
 public boolean isSuspended() 
    Suspended flag accessor.
 public  void recycle() 
    Release all object references, and initialize instance variables, in preparation for reuse of this object.
 public  void reset() 
    Clear any content written to the buffer.
 public  void reset(int status,
    String message) 
    Reset this response, and specify the values for the HTTP status code and corresponding message.
 public  void resetBuffer() 
    Reset the data buffer but not any status or header information.
 public  void resetBuffer(boolean resetWriterStreamFlags) 
    Reset the data buffer and the using Writer/Stream flags but not any status or header information.
 public  void sendAcknowledgement() throws IOException 
    Send an acknowledgment of a request.
 public  void sendError(int status) throws IOException 
    Send an error response with the specified status and a default message.
 public  void sendError(int status,
    String message) throws IOException 
    Send an error response with the specified status and message.
 public  void sendRedirect(String location) throws IOException 
    Send a temporary redirect to the specified redirect location URL.
 public  void setAppCommitted(boolean appCommitted) 
    Set the application commit flag.
 public  void setBufferSize(int size) 
    Set the buffer size to be used for this Response.
 public  void setCharacterEncoding(String charset) 
 public  void setConnector(Connector connector) 
    Set the Connector through which this Request was received.
 public  void setContentLength(int length) 
    Set the content length (in bytes) for this Response.
 public  void setContentType(String type) 
    Set the content type for this Response.
 public  void setContext(Context context) 
    Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned by getContextPath(), and thus enables parsing of the request URI.
 public  void setCoyoteResponse(Response coyoteResponse) 
    Set the Coyote response.
 public  void setDateHeader(String name,
    long value) 
    Set the specified date header to the specified value.
 public  void setError() 
    Set the error flag.
 public  void setHeader(String name,
    String value) 
    Set the specified header to the specified value.
 public  void setIncluded(boolean included) 
    Set the "processing inside an include" flag.
 public  void setIntHeader(String name,
    int value) 
    Set the specified integer header to the specified value.
 public  void setLocale(Locale locale) 
    Set the Locale that is appropriate for this response, including setting the appropriate character encoding.
 public  void setRequest(Request request) 
    Set the Request with which this Response is associated.
 public  void setStatus(int status) 
    Set the HTTP status to be returned with this response.
 public  void setStatus(int status,
    String message) 
Deprecated! As - of Version 2.1 of the Java Servlet API, this method has been deprecated due to the ambiguous meaning of the message parameter.

    Set the HTTP status and message to be returned with this response.
 public  void setStream(OutputStream stream) 
    Set the output stream associated with this Response.
 public  void setSuspended(boolean suspended) 
    Set the suspended flag.
 protected String toEncoded(String url,
    String sessionId) 
    Return the specified URL with the specified session identifier suitably encoded.