Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.coyote.tomcat5.CoyoteResponse
Field Summary | |
protected boolean |
|
protected Connector |
|
protected ArrayList |
|
protected Response |
|
protected boolean |
|
protected CoyoteResponseFacade |
|
protected SimpleDateFormat |
|
protected boolean |
|
protected static String |
|
protected OutputBuffer |
|
protected CoyoteOutputStream |
|
protected CharChunk |
|
protected CoyoteRequest |
|
protected static StringManager |
|
protected UEncoder |
|
protected boolean |
|
protected boolean |
|
protected CoyoteWriter |
|
Constructor Summary | |
Method Summary | |
void |
|
void |
|
void |
|
void |
|
boolean |
|
ServletOutputStream |
|
String |
|
String |
|
String |
|
String |
|
void |
|
void |
|
int |
|
String |
|
Connector |
|
int |
|
int |
|
String |
|
Context |
|
Cookie[] |
|
Response |
|
String |
|
String[] |
|
String[] |
|
boolean |
|
String |
|
Locale |
|
String |
|
ServletOutputStream |
|
PrintWriter |
|
Request |
|
ServletResponse |
|
int |
|
OutputStream |
|
PrintWriter |
|
boolean |
|
boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected boolean appCommitted
The application commit flag.
protected ArrayList cookies
The set of Cookies associated with this Response.
protected boolean error
The error flag.
protected SimpleDateFormat format
The date format we will use for creating date headers.
protected boolean included
The included flag.
protected static final String info
Descriptive information about this Response implementation.
protected boolean usingOutputStream
Using output stream flag.
protected boolean usingWriter
Using writer flag.
public void addCookie(Cookie cookie)
Add the specified Cookie to those that will be included with this Response.
- Parameters:
cookie
- Cookie to be added
public void addDateHeader(String name, long value)
Add the specified date header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Date value to be set
public void addHeader(String name, String value)
Add the specified header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Value to be set
public void addIntHeader(String name, int value)
Add the specified integer header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Integer value to be set
public boolean containsHeader(String name)
Has the specified header been set already in this response?
- Parameters:
name
- Name of the header to check
public ServletOutputStream createOutputStream() throws IOException
Create and return a ServletOutputStream to write the content associated with this Response.
- Specified by:
- createOutputStream in interface Response
public String encodeRedirectURL(String url)
Encode the session identifier associated with this response into the specified redirect URL, if necessary.
- Parameters:
url
- URL to be encoded
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.
- Parameters:
url
- URL to be encoded
public String encodeURL(String url)
Encode the session identifier associated with this response into the specified URL, if necessary.
- Parameters:
url
- URL to be encoded
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.
- Parameters:
url
- URL to be encoded
public void finishResponse() throws IOException
Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
- Specified by:
- finishResponse in interface Response
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.
- Specified by:
- getConnector in interface Response
public int getContentCount()
Return the number of bytes actually written to the output stream.
- Specified by:
- getContentCount in interface Response
public int getContentLength()
Return the content length that was set or calculated for this Response.
- Specified by:
- getContentLength in interface Response
public String getContentType()
Return the content type that was set or calculated for this response, ornull
if no content type was set.
- Specified by:
- getContentType in interface Response
public Context getContext()
Return the Context within which this Request is being processed.
- Specified by:
- getContext in interface Response
public Cookie[] getCookies()
Return an array of all cookies set for this response, or a zero-length array if no cookies have been set.
- Specified by:
- getCookies in interface HttpResponse
public String getHeader(String name)
Return the value for the specified header, ornull
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.
- Specified by:
- getHeader in interface HttpResponse
- Parameters:
name
- Header name to look up
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.
- Specified by:
- getHeaderNames in interface HttpResponse
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.
- Specified by:
- getHeaderValues in interface HttpResponse
- Parameters:
name
- Header name to look up
public boolean getIncluded()
Return the "processing inside an include" flag.
- Specified by:
- getIncluded in interface Response
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 withsendError()
for this Response.
- Specified by:
- getMessage in interface HttpResponse
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.
- 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.
public Request getRequest()
Return the Request with which this Response is associated.
- Specified by:
- getRequest in interface Response
public ServletResponse getResponse()
Return theServletResponse
for which this object is the facade.
- Specified by:
- getResponse in interface Response
public int getStatus()
Return the HTTP status code associated with this Response.
- Specified by:
- getStatus in interface HttpResponse
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.
- Specified by:
- isAppCommitted in interface Response
public boolean isCommitted()
Has the output of this response already been committed?
protected boolean isEncodeable(String location)
Returntrue
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
- Parameters:
location
- Absolute URL to be validated
public boolean isSuspended()
Suspended flag accessor.
- Specified by:
- isSuspended in interface Response
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.
- Specified by:
- reset in interface HttpResponse
public void resetBuffer()
Reset the data buffer but not any status or header information.
- Specified by:
- resetBuffer in interface Response
public void sendAcknowledgement() throws IOException
Send an acknowledgment of a request.
- Specified by:
- sendAcknowledgement in interface Response
public void sendError(int status) throws IOException
Send an error response with the specified status and a default message.
- Parameters:
status
- HTTP status code to send
public void sendError(int status, String message) throws IOException
Send an error response with the specified status and message.
- Parameters:
status
- HTTP status code to sendmessage
- Corresponding message to send
public void sendRedirect(String location) throws IOException
Send a temporary redirect to the specified redirect location URL.
- Parameters:
location
- Location URL to redirect to
public void setAppCommitted(boolean appCommitted)
Set the application commit flag.
- Specified by:
- setAppCommitted in interface Response
- Parameters:
appCommitted
- The new application committed flag value
public void setBufferSize(int size)
Set the buffer size to be used for this Response.
- Parameters:
size
- The new buffer size
public void setCharacterEncoding(String charset)
public void setConnector(Connector connector)
Set the Connector through which this Request was received.
- Specified by:
- setConnector in interface Response
- Parameters:
connector
- The new connector
public void setContentLength(int length)
Set the content length (in bytes) for this Response.
- Parameters:
length
- The new content length
public void setContentType(String type)
Set the content type for this Response.
- Parameters:
type
- The new content type
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 bygetContextPath()
, and thus enables parsing of the request URI.
- Specified by:
- setContext in interface Response
- Parameters:
context
- The newly associated Context
public void setCoyoteResponse(Response coyoteResponse)
Set the Coyote response.
- Parameters:
public void setDateHeader(String name, long value)
Set the specified date header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Date value to be set
public void setHeader(String name, String value)
Set the specified header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Value to be set
public void setIncluded(boolean included)
Set the "processing inside an include" flag.
- Specified by:
- setIncluded in interface Response
- Parameters:
included
-true
if we are currently inside a RequestDispatcher.include(), elsefalse
public void setIntHeader(String name, int value)
Set the specified integer header to the specified value.
- Parameters:
name
- Name of the header to setvalue
- Integer value to be set
public void setLocale(Locale locale)
Set the Locale that is appropriate for this response, including setting the appropriate character encoding.
- Parameters:
locale
- The new locale
public void setRequest(Request request)
Set the Request with which this Response is associated.
- Specified by:
- setRequest in interface Response
- Parameters:
request
- The new associated request
public void setStatus(int status)
Set the HTTP status to be returned with this response.
- Parameters:
status
- The new HTTP status
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.
- Parameters:
status
- The new HTTP statusmessage
- The associated text message
public void setStream(OutputStream stream)
Set the output stream associated with this Response.
- Parameters:
stream
- The new output stream
public void setSuspended(boolean suspended)
Set the suspended flag.
- Specified by:
- setSuspended in interface Response
- Parameters:
suspended
- The new suspended flag value