|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.http.AbstractCauchoResponse
com.caucho.server.http.HttpServletResponseImpl
public final class HttpServletResponseImpl
User facade for http responses.
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
HttpServletResponseImpl(HttpServletRequestImpl request,
AbstractHttpResponse response)
|
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
Adds a cookie to the response. |
void |
addDateHeader(java.lang.String name,
long date)
Adds a header by converting a date to a string. |
void |
addFooter(java.lang.String key,
java.lang.String value)
|
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. |
protected void |
addServletCookie(WebApp webApp)
|
void |
close()
|
void |
closeImpl()
|
boolean |
containsHeader(java.lang.String name)
Returns true if the output headers include name |
protected Cookie |
createServletCookie(WebApp webApp)
|
void |
disable()
Disables the response |
void |
enable()
Enables the response |
java.lang.String |
encodeAbsoluteRedirect(java.lang.String url)
|
java.lang.String |
encodeRedirectUrl(java.lang.String string)
Deprecated. |
java.lang.String |
encodeRedirectURL(java.lang.String string)
Encodes session information in a URL suitable for sendRedirect() |
java.lang.String |
encodeUrl(java.lang.String string)
Deprecated. |
java.lang.String |
encodeURL(java.lang.String string)
Encodes session information in a URL. |
void |
flushBuffer()
Flushes the buffer to the client. |
AbstractHttpResponse |
getAbstractHttpResponse()
|
int |
getBufferSize()
Returns the size of the output buffer. |
AbstractCacheFilterChain |
getCacheInvocation()
|
java.lang.String |
getCharacterEncoding()
Gets the character encoding. |
java.lang.String |
getCharacterEncodingImpl()
Gets the character encoding. |
java.lang.String |
getContentType()
Gets the content type. |
java.lang.String |
getContentTypeImpl()
Gets the content type. |
Cookie |
getCookie(java.lang.String name)
|
java.util.ArrayList<Cookie> |
getCookies()
|
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 |
java.util.Locale |
getLocale()
Returns the output locale. |
ServletOutputStream |
getOutputStream()
Returns an output stream for writing to the client. |
boolean |
getPrivateCache()
Returns the value of the private cache. |
int |
getRemaining()
|
HttpServletRequestImpl |
getRequest()
|
ServletResponse |
getResponse()
Return wrapped response |
AbstractResponseStream |
getResponseStream()
|
java.lang.String |
getSessionId()
|
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()
|
boolean |
isCacheControl()
True if the application has a set a cache-control directive that Resin doesn't understand. |
boolean |
isCauchoResponseStream()
|
boolean |
isCommitted()
Returns true if some data has actually been send to the client. |
boolean |
isDisableCache()
|
boolean |
isDisabled()
Returns true if the response is disabled |
boolean |
isForwardEnclosed()
|
boolean |
isNoCache()
Returns true if the page is non-cacheable |
boolean |
isNoCacheUnlessVary()
Return true if no-cache without var. |
boolean |
isPrivateCache()
Returns true if the response should contain a Cache-Control: private |
void |
killCache()
Set if the page is non-cacheable. |
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)
Sends an HTTP error page based on the status code |
void |
sendError(int code,
java.lang.String value)
Sends an HTTP error to the browser. |
void |
sendRedirect(java.lang.String url)
Sends a redirect to the browser. |
void |
setBufferSize(int size)
Sets the output buffer size to size. |
void |
setCacheControl(boolean isCacheControl)
True if the application has a set a cache-control directive that Resin doesn't understand. |
void |
setCacheInvocation(AbstractCacheFilterChain cacheInvocation)
Sets the cache invocation to indicate that the response might be cacheable. |
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding. |
void |
setContentLength(int len)
Explicitly sets the length of the result value. |
void |
setContentType(java.lang.String value)
Sets the browser content type. |
void |
setDateHeader(java.lang.String name,
long date)
Sets a header by converting a date to a string. |
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 error)
|
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 |
setLocale(java.util.Locale locale)
Sets the output locale. |
void |
setNoCache(boolean isNoCache)
Set if the page is non-cacheable. |
void |
setNoCacheUnlessVary(boolean isNoCacheUnlessVary)
Set no cache w/o vary |
void |
setPrivateCache(boolean isPrivate)
Sets true if the cache is only for the browser, but not Resin's cache or proxies. |
void |
setPrivateOrResinCache(boolean isPrivate)
Sets true if the cache is only for the browser and Resin's cache but not proxies. |
void |
setResponseStream(AbstractResponseStream responseStream)
|
void |
setSessionId(java.lang.String id)
|
void |
setStatus(int code)
Sets the HTTP status |
void |
setStatus(int code,
java.lang.String message)
Sets the HTTP status |
java.lang.String |
toString()
|
| Methods inherited from class com.caucho.server.http.AbstractCauchoResponse |
|---|
completeCache, 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 |
|---|
completeCache, writeHeaders |
| Constructor Detail |
|---|
public HttpServletResponseImpl(HttpServletRequestImpl request,
AbstractHttpResponse response)
| Method Detail |
|---|
public HttpServletRequestImpl getRequest()
public ServletOutputStream getOutputStream()
throws java.io.IOException
getOutputStream in interface ServletResponsejava.io.IOException
public java.io.PrintWriter getWriter()
throws java.io.IOException
getWriter in interface ServletResponsejava.io.IOExceptionpublic void setBufferSize(int size)
size. The servlet engine
may round the size up.
setBufferSize in interface ServletResponsesize - the new output buffer size.public int getBufferSize()
getBufferSize in interface ServletResponsepublic int getRemaining()
public void flushBuffer()
throws java.io.IOException
flushBuffer in interface ServletResponsejava.io.IOExceptionpublic boolean isCommitted()
isCommitted in interface ServletResponsepublic void reset()
reset() after data has been committed is illegal.
reset in interface ServletResponsejava.lang.IllegalStateException - if isCommitted() is true.public void resetBuffer()
reset() after data has been committed is illegal.
resetBuffer in interface ServletResponsejava.lang.IllegalStateException - if isCommitted() is true.public void setContentLength(int len)
setContentLength in interface ServletResponsepublic void disable()
public void enable()
public boolean isDisabled()
public void setLocale(java.util.Locale locale)
ServletResponse
setLocale in interface ServletResponsepublic java.util.Locale getLocale()
ServletResponse
getLocale in interface ServletResponsepublic void setPrivateCache(boolean isPrivate)
Since proxy caching also caches headers, cached pages with session ids can't be cached in the browser. XXX: but doesn't this just mean that Resin shouldn't send the session information back if the page is cached? Because a second request where everything is identical would see the same response except for the cookies.
setPrivateCache in interface CauchoResponsepublic void setPrivateOrResinCache(boolean isPrivate)
public void setCacheInvocation(AbstractCacheFilterChain cacheInvocation)
setCacheInvocation in interface CauchoResponsepublic final AbstractCacheFilterChain getCacheInvocation()
public void setNoCacheUnlessVary(boolean isNoCacheUnlessVary)
public boolean isNoCacheUnlessVary()
isNoCacheUnlessVary in interface CauchoResponsepublic boolean getPrivateCache()
public boolean isPrivateCache()
public boolean isCacheControl()
public void setCacheControl(boolean isCacheControl)
public void setNoCache(boolean isNoCache)
setNoCache in interface CauchoResponsepublic boolean isNoCache()
public void killCache()
killCache in interface CauchoResponsepublic boolean isDisableCache()
public void setStatus(int code)
setStatus in interface HttpServletResponsecode - the HTTP status code
public void setStatus(int code,
java.lang.String message)
setStatus in interface HttpServletResponsecode - the HTTP status codemessage - the HTTP status message
public void sendError(int code)
throws java.io.IOException
sendError in interface HttpServletResponsecode - the HTTP status code
java.io.IOException
public void sendError(int code,
java.lang.String value)
throws java.io.IOException
sendError in interface HttpServletResponsecode - the HTTP error codevalue - a string message
java.io.IOExceptionpublic void setContentType(java.lang.String value)
For example, to set the output encoding to use UTF-8 instead of
the default ISO-8859-1 (Latin-1), use the following:
setContentType("text/html; charset=UTF-8");
setContentType in interface ServletResponsevalue - the mime type of the outputpublic java.lang.String getContentType()
getContentType in interface ServletResponsepublic java.lang.String getContentTypeImpl()
public java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic java.lang.String getCharacterEncodingImpl()
public void setCharacterEncoding(java.lang.String encoding)
setCharacterEncoding in interface ServletResponse
public void sendRedirect(java.lang.String url)
throws java.io.IOException
sendRedirect in interface HttpServletResponseurl - the possibly relative url to send to the browser
java.io.IOExceptionpublic java.lang.String encodeAbsoluteRedirect(java.lang.String url)
public void setHeader(java.lang.String name,
java.lang.String value)
setHeader in interface HttpServletResponsename - the header namevalue - the header value
public void addHeader(java.lang.String name,
java.lang.String value)
addHeader in interface HttpServletResponsename - the header namevalue - the header valuepublic boolean containsHeader(java.lang.String name)
name
containsHeader in interface HttpServletResponsename - the header name to test
public void setDateHeader(java.lang.String name,
long date)
To set the page to expire in 15 seconds use the following:
long now = System.currentTime();
response.setDateHeader("Expires", now + 15000);
setDateHeader in interface HttpServletResponsename - name of the headerdate - the date in milliseconds since the epoch.
public void addDateHeader(java.lang.String name,
long date)
addDateHeader in interface HttpServletResponsename - name of the headerdate - the date in milliseconds since the epoch.
public void setIntHeader(java.lang.String name,
int value)
setIntHeader in interface HttpServletResponsename - name of the headervalue - the value as an integer
public void addIntHeader(java.lang.String name,
int value)
addIntHeader in interface HttpServletResponsename - name of the headervalue - the value as an integerpublic void addCookie(Cookie cookie)
addCookie in interface HttpServletResponsecookie - the response cookiepublic Cookie getCookie(java.lang.String name)
public java.util.ArrayList<Cookie> getCookies()
public java.lang.String getSessionId()
public void setSessionId(java.lang.String id)
setSessionId in interface CauchoResponseprotected void addServletCookie(WebApp webApp)
protected Cookie createServletCookie(WebApp webApp)
public java.lang.String encodeURL(java.lang.String string)
encodeURL in interface HttpServletResponsestring - the url to encode
public java.lang.String encodeRedirectURL(java.lang.String string)
HttpServletResponsesendRedirect()
encodeRedirectURL in interface HttpServletResponsestring - the url to encode
public java.lang.String encodeRedirectUrl(java.lang.String string)
encodeRedirectUrl in interface HttpServletResponsepublic java.lang.String encodeUrl(java.lang.String string)
encodeUrl in interface HttpServletResponsepublic AbstractResponseStream getResponseStream()
getResponseStream in interface CauchoResponsepublic void setResponseStream(AbstractResponseStream responseStream)
setResponseStream in interface CauchoResponsepublic boolean isCauchoResponseStream()
isCauchoResponseStream in interface CauchoResponsepublic java.lang.String getHeader(java.lang.String key)
HttpServletResponse
getHeader in interface CauchoResponsegetHeader in interface HttpServletResponse
public void setFooter(java.lang.String key,
java.lang.String value)
setFooter in interface CauchoResponse
public void addFooter(java.lang.String key,
java.lang.String value)
addFooter in interface CauchoResponse
public void close()
throws java.io.IOException
close in interface CauchoResponsejava.io.IOExceptionpublic void setForbidForward(boolean forbid)
setForbidForward in interface CauchoResponsepublic boolean getForbidForward()
getForbidForward in interface CauchoResponsepublic boolean hasError()
hasError in interface CauchoResponsepublic void setHasError(boolean error)
setHasError in interface CauchoResponsepublic ServletResponse getResponse()
CauchoResponse
getResponse in interface CauchoResponsepublic AbstractHttpResponse getAbstractHttpResponse()
getAbstractHttpResponse in interface CauchoResponsepublic int getStatus()
HttpServletResponse
getStatus in interface HttpServletResponsepublic java.lang.String getStatusMessage()
getStatusMessage in interface CauchoResponsepublic java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
HttpServletResponse
getHeaders in interface HttpServletResponsepublic java.util.Collection<java.lang.String> getHeaderNames()
HttpServletResponseHttpServletResponse.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 HttpServletResponsepublic void setForwardEnclosed(boolean isForwardEnclosed)
setForwardEnclosed in interface CauchoResponsepublic boolean isForwardEnclosed()
isForwardEnclosed in interface CauchoResponse
public void closeImpl()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class AbstractCauchoResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||