org.apache.catalina.core
Class DummyResponse

java.lang.Object
  extended byorg.apache.catalina.core.DummyResponse
All Implemented Interfaces:
HttpResponse, javax.servlet.http.HttpServletResponse, Response, javax.servlet.ServletResponse

public class DummyResponse
extends java.lang.Object
implements HttpResponse, javax.servlet.http.HttpServletResponse

Dummy response object, used for JSP precompilation.

Version:
$Revision: 1.3 $ $Date: 2004/02/27 14:58:42 $
Author:
Remy Maucherat

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletResponse
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
 
Constructor Summary
DummyResponse()
           
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
           
 void addDateHeader(java.lang.String name, long value)
           
 void addHeader(java.lang.String name, java.lang.String value)
           
 void addIntHeader(java.lang.String name, int value)
           
 boolean containsHeader(java.lang.String name)
           
 javax.servlet.ServletOutputStream createOutputStream()
          Create and return a ServletOutputStream to write the content associated with this Response.
 java.lang.String encodeRedirectUrl(java.lang.String url)
           
 java.lang.String encodeRedirectURL(java.lang.String url)
           
 java.lang.String encodeUrl(java.lang.String url)
           
 java.lang.String encodeURL(java.lang.String url)
           
 void finishResponse()
          Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
 void flushBuffer()
           
 int getBufferSize()
           
 java.lang.String getCharacterEncoding()
           
 Connector getConnector()
          Return the Connector through which this Response is returned.
 int getContentCount()
          Return the number of bytes actually written to the output stream.
 int getContentLength()
          Return the content length that was set or calculated for this Response.
 java.lang.String getContentType()
          Return the content type that was set or calculated for this response, or null if no content type was set.
 Context getContext()
          Return the Context with which this Response is associated.
 javax.servlet.http.Cookie[] getCookies()
          Return an array of all cookies set for this response, or a zero-length array if no cookies have been set.
 java.lang.String getHeader(java.lang.String name)
          Return the value for the specified header, or null if this header has not been set.
 java.lang.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.
 java.lang.String[] getHeaderValues(java.lang.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.
 boolean getIncluded()
          Return the "processing inside an include" flag.
 java.lang.String getInfo()
          Return descriptive information about this Response implementation and the corresponding version number, in the format <description>/<version>.
 java.util.Locale getLocale()
           
 java.lang.String getMessage()
          Return the error message that was set with sendError() for this Response.
 javax.servlet.ServletOutputStream getOutputStream()
           
 java.io.PrintWriter getReporter()
          Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has already been acquired.
 Request getRequest()
          Return the Request with which this Response is associated.
 javax.servlet.ServletResponse getResponse()
          Return the ServletResponse for which this object is the facade.
 int getStatus()
          Return the HTTP status code associated with this Response.
 java.io.OutputStream getStream()
          Return the output stream associated with this Response.
 java.io.PrintWriter getWriter()
           
 boolean isAppCommitted()
          Application commit flag accessor.
 boolean isCommitted()
           
 boolean isError()
          Error flag accessor.
 boolean isSuspended()
          Suspended flag accessor.
 void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void reset()
           
 void reset(int status, java.lang.String message)
          Reset this response, and specify the values for the HTTP status code and corresponding message.
 void resetBuffer()
          Reset the data buffer but not any status or header information.
 void sendAcknowledgement()
          Send an acknowledgment of a request.
 void sendError(int status)
           
 void sendError(int status, java.lang.String message)
           
 void sendRedirect(java.lang.String location)
           
 void setAppCommitted(boolean appCommitted)
          Set the application commit flag.
 void setBufferSize(int size)
           
 void setCharacterEncoding(java.lang.String charEncoding)
           
 void setConnector(Connector connector)
          Set the Connector through which this Response is returned.
 void setContentLength(int length)
           
 void setContentType(java.lang.String type)
           
 void setContext(Context context)
          Set the Context with which this Response is associated.
 void setDateHeader(java.lang.String name, long value)
           
 void setError()
          Set the error flag.
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setIncluded(boolean included)
          Set the "processing inside an include" flag.
 void setIntHeader(java.lang.String name, int value)
           
 void setLocale(java.util.Locale locale)
           
 void setRequest(Request request)
          Set the Request with which this Response is associated.
 void setStatus(int status)
           
 void setStatus(int status, java.lang.String message)
           
 void setStream(java.io.OutputStream stream)
          Set the output stream associated with this Response.
 void setSuspended(boolean suspended)
          Set the suspended flag.
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyResponse

public DummyResponse()
Method Detail

setAppCommitted

public void setAppCommitted(boolean appCommitted)
Description copied from interface: Response
Set the application commit flag.

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

isAppCommitted

public boolean isAppCommitted()
Description copied from interface: Response
Application commit flag accessor.

Specified by:
isAppCommitted in interface Response

getConnector

public Connector getConnector()
Description copied from interface: Response
Return the Connector through which this Response is returned.

Specified by:
getConnector in interface Response

setConnector

public void setConnector(Connector connector)
Description copied from interface: Response
Set the Connector through which this Response is returned.

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

getContentCount

public int getContentCount()
Description copied from interface: Response
Return the number of bytes actually written to the output stream.

Specified by:
getContentCount in interface Response

getContext

public Context getContext()
Description copied from interface: Response
Return the Context with which this Response is associated.

Specified by:
getContext in interface Response

setContext

public void setContext(Context context)
Description copied from interface: Response
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()
Description copied from interface: Response
Return the "processing inside an include" flag.

Specified by:
getIncluded in interface Response

setIncluded

public void setIncluded(boolean included)
Description copied from interface: Response
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()
Description copied from interface: Response
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()
Description copied from interface: Response
Return the Request with which this Response is associated.

Specified by:
getRequest in interface Response

setRequest

public void setRequest(Request request)
Description copied from interface: Response
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()
Description copied from interface: Response
Return the ServletResponse for which this object is the facade.

Specified by:
getResponse in interface Response

getStream

public java.io.OutputStream getStream()
Description copied from interface: Response
Return the output stream associated with this Response.

Specified by:
getStream in interface Response

setStream

public void setStream(java.io.OutputStream stream)
Description copied from interface: Response
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)
Description copied from interface: Response
Set the suspended flag.

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

isSuspended

public boolean isSuspended()
Description copied from interface: Response
Suspended flag accessor.

Specified by:
isSuspended in interface Response

setError

public void setError()
Description copied from interface: Response
Set the error flag.

Specified by:
setError in interface Response

isError

public boolean isError()
Description copied from interface: Response
Error flag accessor.

Specified by:
isError in interface Response

createOutputStream

public javax.servlet.ServletOutputStream createOutputStream()
                                                     throws java.io.IOException
Description copied from interface: Response
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
Description copied from interface: Response
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()
Description copied from interface: Response
Return the content length that was set or calculated for this Response.

Specified by:
getContentLength in interface Response

getContentType

public java.lang.String getContentType()
Description copied from interface: Response
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()
Description copied from interface: Response
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()
Description copied from interface: Response
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
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Specified by:
flushBuffer in interface javax.servlet.ServletResponse
Throws:
java.io.IOException

getBufferSize

public int getBufferSize()
Specified by:
getBufferSize in interface javax.servlet.ServletResponse

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Specified by:
getCharacterEncoding in interface javax.servlet.ServletResponse

setCharacterEncoding

public void setCharacterEncoding(java.lang.String charEncoding)
Specified by:
setCharacterEncoding in interface javax.servlet.ServletResponse

getOutputStream

public javax.servlet.ServletOutputStream getOutputStream()
                                                  throws java.io.IOException
Specified by:
getOutputStream in interface javax.servlet.ServletResponse
Throws:
java.io.IOException

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface javax.servlet.ServletResponse

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Specified by:
getWriter in interface javax.servlet.ServletResponse
Throws:
java.io.IOException

isCommitted

public boolean isCommitted()
Specified by:
isCommitted in interface javax.servlet.ServletResponse

reset

public void reset()
Specified by:
reset in interface javax.servlet.ServletResponse

resetBuffer

public void resetBuffer()
Description copied from interface: Response
Reset the data buffer but not any status or header information.

Specified by:
resetBuffer in interface Response

setBufferSize

public void setBufferSize(int size)
Specified by:
setBufferSize in interface javax.servlet.ServletResponse

setContentLength

public void setContentLength(int length)
Specified by:
setContentLength in interface javax.servlet.ServletResponse

setContentType

public void setContentType(java.lang.String type)
Specified by:
setContentType in interface javax.servlet.ServletResponse

setLocale

public void setLocale(java.util.Locale locale)
Specified by:
setLocale in interface javax.servlet.ServletResponse

getCookies

public javax.servlet.http.Cookie[] getCookies()
Description copied from interface: HttpResponse
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

getHeader

public java.lang.String getHeader(java.lang.String name)
Description copied from interface: HttpResponse
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.

Specified by:
getHeader in interface HttpResponse
Parameters:
name - Header name to look up

getHeaderNames

public java.lang.String[] getHeaderNames()
Description copied from interface: HttpResponse
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

getHeaderValues

public java.lang.String[] getHeaderValues(java.lang.String name)
Description copied from interface: HttpResponse
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

getMessage

public java.lang.String getMessage()
Description copied from interface: HttpResponse
Return the error message that was set with sendError() for this Response.

Specified by:
getMessage in interface HttpResponse

getStatus

public int getStatus()
Description copied from interface: HttpResponse
Return the HTTP status code associated with this Response.

Specified by:
getStatus in interface HttpResponse

reset

public void reset(int status,
                  java.lang.String message)
Description copied from interface: HttpResponse
Reset this response, and specify the values for the HTTP status code and corresponding message.

Specified by:
reset in interface HttpResponse

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Specified by:
addCookie in interface javax.servlet.http.HttpServletResponse

addDateHeader

public void addDateHeader(java.lang.String name,
                          long value)
Specified by:
addDateHeader in interface javax.servlet.http.HttpServletResponse

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Specified by:
addHeader in interface javax.servlet.http.HttpServletResponse

addIntHeader

public void addIntHeader(java.lang.String name,
                         int value)
Specified by:
addIntHeader in interface javax.servlet.http.HttpServletResponse

containsHeader

public boolean containsHeader(java.lang.String name)
Specified by:
containsHeader in interface javax.servlet.http.HttpServletResponse

encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.String url)
Specified by:
encodeRedirectURL in interface javax.servlet.http.HttpServletResponse

encodeRedirectUrl

public java.lang.String encodeRedirectUrl(java.lang.String url)
Specified by:
encodeRedirectUrl in interface javax.servlet.http.HttpServletResponse

encodeURL

public java.lang.String encodeURL(java.lang.String url)
Specified by:
encodeURL in interface javax.servlet.http.HttpServletResponse

encodeUrl

public java.lang.String encodeUrl(java.lang.String url)
Specified by:
encodeUrl in interface javax.servlet.http.HttpServletResponse

sendAcknowledgement

public void sendAcknowledgement()
                         throws java.io.IOException
Description copied from interface: Response
Send an acknowledgment of a request.

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

sendError

public void sendError(int status)
               throws java.io.IOException
Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Throws:
java.io.IOException

sendError

public void sendError(int status,
                      java.lang.String message)
               throws java.io.IOException
Specified by:
sendError in interface javax.servlet.http.HttpServletResponse
Throws:
java.io.IOException

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
Specified by:
sendRedirect in interface javax.servlet.http.HttpServletResponse
Throws:
java.io.IOException

setDateHeader

public void setDateHeader(java.lang.String name,
                          long value)
Specified by:
setDateHeader in interface javax.servlet.http.HttpServletResponse

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Specified by:
setHeader in interface javax.servlet.http.HttpServletResponse

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Specified by:
setIntHeader in interface javax.servlet.http.HttpServletResponse

setStatus

public void setStatus(int status)
Specified by:
setStatus in interface javax.servlet.http.HttpServletResponse

setStatus

public void setStatus(int status,
                      java.lang.String message)
Specified by:
setStatus in interface javax.servlet.http.HttpServletResponse


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.