|
||||||||||
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 |
isCaching()
|
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 |
setContentLength(long length)
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 ServletResponse
java.io.IOException
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface ServletResponse
java.io.IOException
public void setBufferSize(int size)
size
. The servlet engine
may round the size up.
setBufferSize
in interface ServletResponse
size
- the new output buffer size.public int getBufferSize()
getBufferSize
in interface ServletResponse
public int getRemaining()
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface ServletResponse
java.io.IOException
public final boolean isCommitted()
isCommitted
in interface ServletResponse
public void reset()
reset()
after data has been committed is illegal.
reset
in interface ServletResponse
java.lang.IllegalStateException
- if isCommitted()
is true.public void resetBuffer()
reset()
after data has been committed is illegal.
resetBuffer
in interface ServletResponse
java.lang.IllegalStateException
- if isCommitted()
is true.public void setContentLength(int len)
setContentLength
in interface ServletResponse
public void setContentLength(long length)
setContentLength
in interface CauchoResponse
public void disable()
public void enable()
public boolean isDisabled()
public void setLocale(java.util.Locale locale)
ServletResponse
setLocale
in interface ServletResponse
public java.util.Locale getLocale()
ServletResponse
getLocale
in interface ServletResponse
public 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 CauchoResponse
public void setPrivateOrResinCache(boolean isPrivate)
public void setCacheInvocation(AbstractCacheFilterChain cacheInvocation)
setCacheInvocation
in interface CauchoResponse
public final AbstractCacheFilterChain getCacheInvocation()
public boolean isCaching()
isCaching
in interface CauchoResponse
public void setNoCacheUnlessVary(boolean isNoCacheUnlessVary)
public boolean isNoCacheUnlessVary()
isNoCacheUnlessVary
in interface CauchoResponse
public boolean getPrivateCache()
public boolean isPrivateCache()
public boolean isCacheControl()
public void setCacheControl(boolean isCacheControl)
public void setNoCache(boolean isNoCache)
setNoCache
in interface CauchoResponse
public boolean isNoCache()
public void killCache()
killCache
in interface CauchoResponse
public boolean isDisableCache()
public void setStatus(int code)
setStatus
in interface HttpServletResponse
code
- the HTTP status codepublic void setStatus(int code, java.lang.String message)
setStatus
in interface HttpServletResponse
code
- the HTTP status codemessage
- the HTTP status messagepublic void sendError(int code) throws java.io.IOException
sendError
in interface HttpServletResponse
code
- the HTTP status code
java.io.IOException
public void sendError(int code, java.lang.String value) throws java.io.IOException
sendError
in interface HttpServletResponse
code
- the HTTP error codevalue
- a string message
java.io.IOException
public 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 ServletResponse
value
- the mime type of the outputpublic java.lang.String getContentType()
getContentType
in interface ServletResponse
public java.lang.String getContentTypeImpl()
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
public 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 HttpServletResponse
url
- the possibly relative url to send to the browser
java.io.IOException
public java.lang.String encodeAbsoluteRedirect(java.lang.String url)
public void setHeader(java.lang.String name, java.lang.String value)
setHeader
in interface HttpServletResponse
name
- the header namevalue
- the header valuepublic void addHeader(java.lang.String name, java.lang.String value)
addHeader
in interface HttpServletResponse
name
- the header namevalue
- the header valuepublic boolean containsHeader(java.lang.String name)
name
containsHeader
in interface HttpServletResponse
name
- the header name to testpublic 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 HttpServletResponse
name
- name of the headerdate
- the date in milliseconds since the epoch.public void addDateHeader(java.lang.String name, long date)
addDateHeader
in interface HttpServletResponse
name
- name of the headerdate
- the date in milliseconds since the epoch.public void setIntHeader(java.lang.String name, int value)
setIntHeader
in interface HttpServletResponse
name
- name of the headervalue
- the value as an integerpublic void addIntHeader(java.lang.String name, int value)
addIntHeader
in interface HttpServletResponse
name
- name of the headervalue
- the value as an integerpublic void addCookie(Cookie cookie)
addCookie
in interface HttpServletResponse
cookie
- 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 CauchoResponse
protected void addServletCookie(WebApp webApp)
protected Cookie createServletCookie(WebApp webApp)
public java.lang.String encodeURL(java.lang.String string)
encodeURL
in interface HttpServletResponse
string
- the url to encode
public java.lang.String encodeRedirectURL(java.lang.String string)
HttpServletResponse
sendRedirect()
encodeRedirectURL
in interface HttpServletResponse
string
- the url to encode
public java.lang.String encodeRedirectUrl(java.lang.String string)
encodeRedirectUrl
in interface HttpServletResponse
public java.lang.String encodeUrl(java.lang.String string)
encodeUrl
in interface HttpServletResponse
public AbstractResponseStream getResponseStream()
getResponseStream
in interface CauchoResponse
public void setResponseStream(AbstractResponseStream responseStream)
setResponseStream
in interface CauchoResponse
public boolean isCauchoResponseStream()
isCauchoResponseStream
in interface CauchoResponse
public java.lang.String getHeader(java.lang.String key)
HttpServletResponse
getHeader
in interface CauchoResponse
getHeader
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 CauchoResponse
java.io.IOException
public void setForbidForward(boolean forbid)
setForbidForward
in interface CauchoResponse
public boolean getForbidForward()
getForbidForward
in interface CauchoResponse
public boolean hasError()
hasError
in interface CauchoResponse
public void setHasError(boolean error)
setHasError
in interface CauchoResponse
public ServletResponse getResponse()
CauchoResponse
getResponse
in interface CauchoResponse
public AbstractHttpResponse getAbstractHttpResponse()
getAbstractHttpResponse
in interface CauchoResponse
public int getStatus()
HttpServletResponse
getStatus
in interface HttpServletResponse
public java.lang.String getStatusMessage()
getStatusMessage
in interface CauchoResponse
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 closeImpl() throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class AbstractCauchoResponse
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |