com.caucho.server.webapp
Class IncludeResponse

java.lang.Object
  extended by com.caucho.server.http.AbstractCauchoResponse
      extended by com.caucho.server.http.CauchoResponseWrapper
          extended by com.caucho.server.webapp.IncludeResponse
All Implemented Interfaces:
CauchoResponse, HttpServletResponse, ServletResponse

public class IncludeResponse
extends CauchoResponseWrapper

Internal response for an include() or forward()


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
 
Method Summary
 void addCookie(Cookie cookie)
          Sends a new cookie to the client.
 void addDateHeader(java.lang.String name, long date)
          Adds a header by converting a date to a string.
 void addHeader(java.lang.String name, java.lang.String value)
          Adds a header.
 void addIntHeader(java.lang.String name, int value)
          Adds a header by converting an integer value to a string.
 void clearBuffer()
           
 void close()
           
 boolean containsHeader(java.lang.String name)
          Returns true if the output headers include name
 void flushBuffer()
          Flushes the buffer to the client.
 void flushHeader()
           
 int getBufferSize()
          Returns the size of the output buffer.
 AbstractCacheFilterChain getCacheInvocation()
           
 java.util.Collection<java.lang.String> getHeaderNames()
          Returns an Iterable for header names set via HttpServletResponse.setHeader(java.lang.String, java.lang.String), HttpServletResponse.addHeader(java.lang.String, java.lang.String), HttpServletResponse.setDateHeader(java.lang.String, long), HttpServletResponse.addDateHeader(java.lang.String, long), HttpServletResponse.setIntHeader(java.lang.String, int), or HttpServletResponse.addIntHeader(java.lang.String, int), respectively.
 java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
          Returns an Iterable for header values with a given name
 java.io.PrintWriter getNextWriter()
          Returns the parent writer.
 AbstractResponseStream getOriginalStream()
          Gets the response stream.
 ServletOutputStream getOutputStream()
          Returns the ServletOutputStream for the response.
 IncludeRequest getRequest()
           
 AbstractResponseStream getResponseStream()
          Gets the response stream.
 java.io.PrintWriter getWriter()
          Returns a PrintWriter for the response.
 boolean isCauchoResponseStream()
          Returns true for a Caucho response stream.
 boolean isForwardEnclosed()
           
 void reset()
          Resets the output stream, clearing headers and the output buffer.
 void resetBuffer()
          Resets the output stream, clearing headers and the output buffer.
 void sendError(int code, java.lang.String msg)
          Sends an HTTP error page based on the status code
 void setBufferSize(int size)
          Sets the output buffer size to size.
 void setCacheInvocation(AbstractCacheFilterChain cacheInvocation)
          Sets the cache invocation to indicate that the response might be cacheable.
 void setContentLength(int length)
          Explicitly sets the length of the result value.
 void setContentType(java.lang.String type)
          included response can't set the content type.
 void setDateHeader(java.lang.String name, long date)
          Sets a header by converting a date to a string.
 void setDisableAutoFlush(boolean disable)
           
 void setForwardEnclosed(boolean isForwardEnclosed)
           
 void setHeader(java.lang.String name, java.lang.String value)
          Sets a header.
 void setIntHeader(java.lang.String name, int value)
          Sets a header by converting an integer value to a string.
 void setResponseStream(AbstractResponseStream responseStream)
          Sets the ResponseStream
 void setStatus(int code)
          Sets the HTTP status
 void setStatus(int code, java.lang.String msg)
           
 
Methods inherited from class com.caucho.server.http.CauchoResponseWrapper
addFooter, completeCache, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, getAbstractHttpResponse, getCauchoResponse, getCharacterEncoding, getContentType, getForbidForward, getHeader, getLocale, getResponse, getStatus, getStatusMessage, hasError, isCommitted, isNoCacheUnlessVary, killCache, sendError, sendInternalError, sendRedirect, setCharacterEncoding, setFooter, setForbidForward, setHasError, setLocale, setMatchCacheEntry, setNoCache, setPrivateCache, setResponse, setSessionId, toString
 
Methods inherited from class com.caucho.server.http.AbstractCauchoResponse
writeHeaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.server.http.CauchoResponse
writeHeaders
 

Method Detail

getRequest

public IncludeRequest getRequest()
Overrides:
getRequest in class CauchoResponseWrapper

setCacheInvocation

public void setCacheInvocation(AbstractCacheFilterChain cacheInvocation)
Sets the cache invocation to indicate that the response might be cacheable.

Specified by:
setCacheInvocation in interface CauchoResponse
Overrides:
setCacheInvocation in class CauchoResponseWrapper

getCacheInvocation

public final AbstractCacheFilterChain getCacheInvocation()

close

public void close()
Specified by:
close in interface CauchoResponse
Overrides:
close in class CauchoResponseWrapper

setStatus

public void setStatus(int code)
Description copied from interface: HttpServletResponse
Sets the HTTP status

Specified by:
setStatus in interface HttpServletResponse
Overrides:
setStatus in class CauchoResponseWrapper
Parameters:
code - the HTTP status code

setStatus

public void setStatus(int code,
                      java.lang.String msg)
Specified by:
setStatus in interface HttpServletResponse
Overrides:
setStatus in class CauchoResponseWrapper

sendError

public void sendError(int code,
                      java.lang.String msg)
Description copied from interface: HttpServletResponse
Sends an HTTP error page based on the status code

Specified by:
sendError in interface HttpServletResponse
Overrides:
sendError in class CauchoResponseWrapper
Parameters:
code - the HTTP status code

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Description copied from interface: HttpServletResponse
Sets a header. This will override a previous header with the same name.

Specified by:
setHeader in interface HttpServletResponse
Overrides:
setHeader in class CauchoResponseWrapper
Parameters:
name - the header name
value - the header value

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Description copied from interface: HttpServletResponse
Adds a header. If another header with the same name exists, both will be sent to the client.

Specified by:
addHeader in interface HttpServletResponse
Overrides:
addHeader in class CauchoResponseWrapper
Parameters:
name - the header name
value - the header value

getHeaders

public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
Description copied from interface: HttpServletResponse
Returns an Iterable for header values with a given name

Specified by:
getHeaders in interface HttpServletResponse
Overrides:
getHeaders in class CauchoResponseWrapper
Returns:

getHeaderNames

public java.util.Collection<java.lang.String> getHeaderNames()
Description copied from interface: HttpServletResponse
Returns an Iterable for header names set via HttpServletResponse.setHeader(java.lang.String, java.lang.String), HttpServletResponse.addHeader(java.lang.String, java.lang.String), HttpServletResponse.setDateHeader(java.lang.String, long), HttpServletResponse.addDateHeader(java.lang.String, long), HttpServletResponse.setIntHeader(java.lang.String, int), or HttpServletResponse.addIntHeader(java.lang.String, int), respectively.

Specified by:
getHeaderNames in interface HttpServletResponse
Overrides:
getHeaderNames in class CauchoResponseWrapper
Returns:

containsHeader

public boolean containsHeader(java.lang.String name)
Description copied from interface: HttpServletResponse
Returns true if the output headers include name

Specified by:
containsHeader in interface HttpServletResponse
Overrides:
containsHeader in class CauchoResponseWrapper
Parameters:
name - the header name to test

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
Description copied from interface: HttpServletResponse
Sets a header by converting a date to a string.

To set the page to expire in 15 seconds use the following:


 long now = System.currentTime();
 response.setDateHeader("Expires", now + 15000);
 

Specified by:
setDateHeader in interface HttpServletResponse
Overrides:
setDateHeader in class CauchoResponseWrapper
Parameters:
name - name of the header
date - the date in milliseconds since the epoch.

addDateHeader

public void addDateHeader(java.lang.String name,
                          long date)
Description copied from interface: HttpServletResponse
Adds a header by converting a date to a string.

Specified by:
addDateHeader in interface HttpServletResponse
Overrides:
addDateHeader in class CauchoResponseWrapper
Parameters:
name - name of the header
date - the date in milliseconds since the epoch.

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Description copied from interface: HttpServletResponse
Sets a header by converting an integer value to a string.

Specified by:
setIntHeader in interface HttpServletResponse
Overrides:
setIntHeader in class CauchoResponseWrapper
Parameters:
name - name of the header
value - the value as an integer

addIntHeader

public void addIntHeader(java.lang.String name,
                         int value)
Description copied from interface: HttpServletResponse
Adds a header by converting an integer value to a string.

Specified by:
addIntHeader in interface HttpServletResponse
Overrides:
addIntHeader in class CauchoResponseWrapper
Parameters:
name - name of the header
value - the value as an integer

addCookie

public void addCookie(Cookie cookie)
Description copied from interface: HttpServletResponse
Sends a new cookie to the client.

Specified by:
addCookie in interface HttpServletResponse
Overrides:
addCookie in class CauchoResponseWrapper

setContentType

public void setContentType(java.lang.String type)
included response can't set the content type.

Specified by:
setContentType in interface ServletResponse
Overrides:
setContentType in class CauchoResponseWrapper
Parameters:
type - the mime type of the output

setContentLength

public void setContentLength(int length)
Description copied from interface: ServletResponse
Explicitly sets the length of the result value. Normally, the servlet engine will handle this.

Specified by:
setContentLength in interface ServletResponse
Overrides:
setContentLength in class CauchoResponseWrapper

setResponseStream

public void setResponseStream(AbstractResponseStream responseStream)
Sets the ResponseStream

Specified by:
setResponseStream in interface CauchoResponse
Overrides:
setResponseStream in class CauchoResponseWrapper

getResponseStream

public AbstractResponseStream getResponseStream()
Gets the response stream.

Specified by:
getResponseStream in interface CauchoResponse
Overrides:
getResponseStream in class CauchoResponseWrapper

getOriginalStream

public AbstractResponseStream getOriginalStream()
Gets the response stream.


isCauchoResponseStream

public boolean isCauchoResponseStream()
Returns true for a Caucho response stream.

Specified by:
isCauchoResponseStream in interface CauchoResponse
Overrides:
isCauchoResponseStream in class CauchoResponseWrapper

getOutputStream

public ServletOutputStream getOutputStream()
                                    throws java.io.IOException
Returns the ServletOutputStream for the response.

Specified by:
getOutputStream in interface ServletResponse
Overrides:
getOutputStream in class CauchoResponseWrapper
Throws:
java.io.IOException

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Returns a PrintWriter for the response.

Specified by:
getWriter in interface ServletResponse
Overrides:
getWriter in class CauchoResponseWrapper
Throws:
java.io.IOException

getNextWriter

public java.io.PrintWriter getNextWriter()
Returns the parent writer.


setBufferSize

public void setBufferSize(int size)
Description copied from interface: ServletResponse
Sets the output buffer size to size. The servlet engine may round the size up.

Specified by:
setBufferSize in interface ServletResponse
Overrides:
setBufferSize in class CauchoResponseWrapper
Parameters:
size - the new output buffer size.

getBufferSize

public int getBufferSize()
Description copied from interface: ServletResponse
Returns the size of the output buffer.

Specified by:
getBufferSize in interface ServletResponse
Overrides:
getBufferSize in class CauchoResponseWrapper

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Description copied from interface: ServletResponse
Flushes the buffer to the client.

Specified by:
flushBuffer in interface ServletResponse
Overrides:
flushBuffer in class CauchoResponseWrapper
Throws:
java.io.IOException

flushHeader

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

setDisableAutoFlush

public void setDisableAutoFlush(boolean disable)

reset

public void reset()
Description copied from interface: ServletResponse
Resets the output stream, clearing headers and the output buffer. Calling reset() after data has been committed is illegal.

Specified by:
reset in interface ServletResponse
Overrides:
reset in class CauchoResponseWrapper

resetBuffer

public void resetBuffer()
Description copied from interface: ServletResponse
Resets the output stream, clearing headers and the output buffer. Calling reset() after data has been committed is illegal.

Specified by:
resetBuffer in interface ServletResponse
Overrides:
resetBuffer in class CauchoResponseWrapper

clearBuffer

public void clearBuffer()

setForwardEnclosed

public void setForwardEnclosed(boolean isForwardEnclosed)
Specified by:
setForwardEnclosed in interface CauchoResponse
Overrides:
setForwardEnclosed in class CauchoResponseWrapper

isForwardEnclosed

public boolean isForwardEnclosed()
Specified by:
isForwardEnclosed in interface CauchoResponse
Overrides:
isForwardEnclosed in class CauchoResponseWrapper