public class ResponseAdapter extends ResponseWrapper implements CauchoResponse
_response
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
Modifier | Constructor and Description |
---|---|
protected |
ResponseAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie cookie)
Sends a new cookie to the client.
|
void |
addFooter(java.lang.String key,
java.lang.String value) |
void |
close() |
void |
completeCache() |
static ResponseAdapter |
create(HttpServletResponse response)
Creates a new ResponseAdapter.
|
protected AbstractResponseStream |
createWrapperResponseStream() |
boolean |
disableHeaders(boolean disable) |
void |
finish() |
protected void |
free()
Clears the adapter.
|
static void |
free(ResponseAdapter resAdapt) |
int |
getBufferSize()
Returns the size of the output buffer.
|
CauchoResponse |
getCauchoResponse() |
java.lang.String |
getCharacterEncodingAssigned()
Assigned value of response encoding, not calculated/default.
|
FlushBuffer |
getFlushBuffer()
Gets the flush buffer
|
boolean |
getForbidForward()
Returns true if RequestDispatcher.forward() is disallowed on
this stream.
|
java.lang.String |
getHeader(java.lang.String key)
Retuns value of header with a given name
|
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
|
ServletOutputStream |
getOutputStream()
Returns an output stream for writing to the client.
|
int |
getRemaining() |
AbstractResponseStream |
getResponseStream() |
int |
getStatus()
Returns the current status code of this response
|
java.lang.String |
getStatusMessage() |
java.io.PrintWriter |
getWriter()
Returns a PrintWriter with the proper character encoding for writing
text data to the client.
|
boolean |
hasError()
Returns true if we're processing an error.
|
void |
init(HttpServletResponse response) |
boolean |
isCauchoResponseStream() |
boolean |
isForwardEnclosed() |
boolean |
isNoCacheUnlessVary() |
boolean |
isTop() |
void |
killCache()
Kills the cache for an error.
|
void |
resetBuffer()
Resets the output stream without clearing headers and the output buffer.
|
void |
sendRedirect(java.lang.String url)
Redirects the client to another page.
|
void |
setBufferSize(int size)
Sets the output buffer size to
size . |
void |
setContentLength(long length) |
void |
setContentType(java.lang.String value)
Sets the response content type.
|
void |
setFlushBuffer(FlushBuffer flushBuffer)
Sets the flush buffer
|
void |
setFooter(java.lang.String key,
java.lang.String value) |
void |
setForbidForward(boolean forbid)
When set to true, RequestDispatcher.forward() is disallowed on
this stream.
|
void |
setForwardEnclosed(boolean isForwardEnclosed) |
void |
setHasError(boolean hasError)
Set to true while processing an error.
|
void |
setNoCache(boolean isPrivate)
Sets no caching
|
void |
setPrivateCache(boolean isPrivate)
Sets private caching
|
void |
setResponseStream(AbstractResponseStream responseStream) |
void |
setSessionId(java.lang.String id) |
void |
writeHeaders(int length) |
addDateHeader, addHeader, addIntHeader, containsHeader, disable, enable, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, flushBuffer, getAbstractHttpResponse, getCharacterEncoding, getContentType, getLocale, getResponse, isCaching, isCommitted, isDisabled, reset, sendError, sendError, setCacheInvocation, setCharacterEncoding, setContentLength, setDateHeader, setHeader, setIntHeader, setLocale, setMatchCacheEntry, setResponse, setStatus, setStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAbstractHttpResponse, getResponse, isCaching, setCacheInvocation
addDateHeader, addHeader, addIntHeader, containsHeader, encodeRedirectUrl, encodeRedirectURL, encodeUrl, encodeURL, sendError, sendError, setDateHeader, setHeader, setIntHeader, setStatus, setStatus
flushBuffer, getCharacterEncoding, getContentType, getLocale, isCommitted, reset, setCharacterEncoding, setContentLength, setLocale
public static ResponseAdapter create(HttpServletResponse response)
protected AbstractResponseStream createWrapperResponseStream()
public void init(HttpServletResponse response)
public AbstractResponseStream getResponseStream()
getResponseStream
in interface CauchoResponse
public boolean isCauchoResponseStream()
isCauchoResponseStream
in interface CauchoResponse
public void setResponseStream(AbstractResponseStream responseStream)
setResponseStream
in interface CauchoResponse
public boolean isTop()
public void resetBuffer()
ResponseWrapper
resetBuffer()
after data has been committed is
illegal.resetBuffer
in interface ServletResponse
resetBuffer
in class ResponseWrapper
public void sendRedirect(java.lang.String url) throws java.io.IOException
ResponseWrapper
sendRedirect
in interface HttpServletResponse
sendRedirect
in class ResponseWrapper
url
- the location to redirect to.java.io.IOException
public int getBufferSize()
ResponseWrapper
getBufferSize
in interface ServletResponse
getBufferSize
in class ResponseWrapper
public void setBufferSize(int size)
ResponseWrapper
size
. The servlet engine
may round the size up.setBufferSize
in interface ServletResponse
setBufferSize
in class ResponseWrapper
size
- the new output buffer size.public ServletOutputStream getOutputStream() throws java.io.IOException
ResponseWrapper
getOutputStream
in interface ServletResponse
getOutputStream
in class ResponseWrapper
java.io.IOException
public void setFlushBuffer(FlushBuffer flushBuffer)
public FlushBuffer getFlushBuffer()
public java.io.PrintWriter getWriter() throws java.io.IOException
ResponseWrapper
getWriter
in interface ServletResponse
getWriter
in class ResponseWrapper
java.io.IOException
public void setContentType(java.lang.String value)
ResponseWrapper
getWriter()
so the writer can use the
proper character encoding.
To set the output character encoding to ISO-8859-2, use the
following:
response.setContentType("text/html; charset=ISO-8859-2");
setContentType
in interface ServletResponse
setContentType
in class ResponseWrapper
value
- the mime type of the outputpublic void setContentLength(long length)
setContentLength
in interface CauchoResponse
public void addCookie(Cookie cookie)
ResponseWrapper
addCookie
in interface HttpServletResponse
addCookie
in class ResponseWrapper
public java.lang.String getHeader(java.lang.String key)
HttpServletResponse
getHeader
in interface CauchoResponse
getHeader
in interface HttpServletResponse
public boolean disableHeaders(boolean disable)
public void setFooter(java.lang.String key, java.lang.String value)
setFooter
in interface CauchoResponse
setFooter
in class ResponseWrapper
public void addFooter(java.lang.String key, java.lang.String value)
addFooter
in interface CauchoResponse
addFooter
in class ResponseWrapper
public int getRemaining()
public void setForbidForward(boolean forbid)
setForbidForward
in interface CauchoResponse
public boolean getForbidForward()
getForbidForward
in interface CauchoResponse
public java.lang.String getStatusMessage()
getStatusMessage
in interface CauchoResponse
public void setHasError(boolean hasError)
setHasError
in interface CauchoResponse
public boolean hasError()
hasError
in interface CauchoResponse
public void killCache()
killCache
in interface CauchoResponse
public void setPrivateCache(boolean isPrivate)
setPrivateCache
in interface CauchoResponse
public void setNoCache(boolean isPrivate)
setNoCache
in interface CauchoResponse
public void setSessionId(java.lang.String id)
setSessionId
in interface CauchoResponse
public boolean isNoCacheUnlessVary()
isNoCacheUnlessVary
in interface CauchoResponse
public CauchoResponse getCauchoResponse()
public void finish() throws java.io.IOException
java.io.IOException
public void completeCache()
completeCache
in interface CauchoResponse
public void close() throws java.io.IOException
close
in interface CauchoResponse
java.io.IOException
public int getStatus()
HttpServletResponse
getStatus
in interface HttpServletResponse
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
HttpServletResponse
getHeaders
in interface HttpServletResponse
public java.util.Collection<java.lang.String> getHeaderNames()
HttpServletResponse
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.getHeaderNames
in interface HttpServletResponse
public void setForwardEnclosed(boolean isForwardEnclosed)
setForwardEnclosed
in interface CauchoResponse
public boolean isForwardEnclosed()
isForwardEnclosed
in interface CauchoResponse
public void writeHeaders(int length)
writeHeaders
in interface CauchoResponse
public static void free(ResponseAdapter resAdapt)
protected void free()
public java.lang.String getCharacterEncodingAssigned()
CauchoResponse
getCharacterEncodingAssigned
in interface CauchoResponse