|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.connection.ResponseWrapper
public class ResponseWrapper
Wraps a servlet response in another response. Filters may use ServletResponseWrapper to grab results from the servlet.
The default methods just call the wrapped response methods.
| Field Summary | |
|---|---|
protected HttpServletResponse |
_response
|
| Constructor Summary | |
|---|---|
ResponseWrapper()
Create a new ServletResponseWrapper, wrapping a specified response. |
|
ResponseWrapper(HttpServletResponse response)
Create a new ServletResponseWrapper, wrapping a specified response. |
|
| 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 |
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. |
boolean |
containsHeader(java.lang.String name)
Returns true if the output headers include name |
void |
disable()
Disables the response |
void |
enable()
Enables the response |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated. |
java.lang.String |
encodeRedirectURL(java.lang.String name)
Encodes session information in a URL suitable for sendRedirect() |
java.lang.String |
encodeUrl(java.lang.String url)
Deprecated. |
java.lang.String |
encodeURL(java.lang.String url)
Encodes session information in a URL. |
void |
flushBuffer()
Flushes the buffer to the client. |
int |
getBufferSize()
Returns the size of the output buffer. |
java.lang.String |
getCharacterEncoding()
Returns the character encoding the response is using for output. |
java.lang.String |
getContentType()
Returns the content type |
java.util.Locale |
getLocale()
Returns the output locale. |
ServletOutputStream |
getOutputStream()
Returns an output stream for writing to the client. |
ServletResponse |
getResponse()
Gets the wrapped response |
java.io.PrintWriter |
getWriter()
Returns a PrintWriter with the proper character encoding for writing text data to the client. |
boolean |
isCommitted()
Returns true if some data has actually been send to the client. |
boolean |
isDisabled()
Returns true if the response is disabled |
void |
reset()
Resets the output stream, clearing headers and the output buffer. |
void |
resetBuffer()
Resets the output stream without clearing headers and the output buffer. |
void |
sendError(int sc)
Sends an HTTP error page based on the status code |
void |
sendError(int sc,
java.lang.String msg)
Sends an HTTP error page based on the status code |
void |
sendRedirect(java.lang.String location)
Redirects the client to another page. |
void |
setBufferSize(int size)
Sets the output buffer size to size. |
void |
setCharacterEncoding(java.lang.String encoding)
Sets the character encoding the response is using for output. |
void |
setContentLength(int len)
Deprecated. |
void |
setContentType(java.lang.String type)
Sets the response 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 |
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 |
setResponse(HttpServletResponse response)
Sets the response to be wrapped. |
void |
setStatus(int sc)
Sets the HTTP status |
void |
setStatus(int sc,
java.lang.String msg)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HttpServletResponse _response
| Constructor Detail |
|---|
public ResponseWrapper()
response - the response to wrap.public ResponseWrapper(HttpServletResponse response)
response - the response to wrap.| Method Detail |
|---|
public void setResponse(HttpServletResponse response)
response - the response to wrap.public ServletResponse getResponse()
public void setContentType(java.lang.String type)
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 ServletResponsetype - the mime type of the outputpublic java.lang.String getContentType()
getContentType in interface ServletResponsepublic java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic void setCharacterEncoding(java.lang.String encoding)
setCharacterEncoding in interface ServletResponsepublic void setLocale(java.util.Locale locale)
setLocale in interface ServletResponsepublic java.util.Locale getLocale()
getLocale in interface ServletResponse
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 ServletResponse
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()
resetBuffer() 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 setStatus(int sc)
sc - the HTTP status code
public void sendError(int sc,
java.lang.String msg)
throws java.io.IOException
sc - the HTTP status code
java.io.IOException
public void sendError(int sc)
throws java.io.IOException
sc - the HTTP status code
java.io.IOException
public void sendRedirect(java.lang.String location)
throws java.io.IOException
location - the location to redirect to.
java.io.IOException
public void setHeader(java.lang.String name,
java.lang.String value)
name - the header namevalue - the header value
public void addHeader(java.lang.String name,
java.lang.String value)
name - the header namevalue - the header valuepublic boolean containsHeader(java.lang.String name)
name
name - 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);
name - name of the headerdate - the date in milliseconds since the epoch.
public void addDateHeader(java.lang.String name,
long date)
name - name of the headerdate - the date in milliseconds since the epoch.
public void setIntHeader(java.lang.String name,
int value)
name - name of the headervalue - the value as an integer
public void addIntHeader(java.lang.String name,
int value)
name - name of the headervalue - the value as an integerpublic void addCookie(Cookie cookie)
public java.lang.String encodeURL(java.lang.String url)
url - the url to encode
public java.lang.String encodeRedirectURL(java.lang.String name)
sendRedirect()
url - the url to encode
public void setStatus(int sc,
java.lang.String msg)
public java.lang.String encodeUrl(java.lang.String url)
public java.lang.String encodeRedirectUrl(java.lang.String url)
public void setFooter(java.lang.String key,
java.lang.String value)
public void addFooter(java.lang.String key,
java.lang.String value)
public void disable()
disable in interface ServletResponsepublic void enable()
enable in interface ServletResponsepublic boolean isDisabled()
isDisabled in interface ServletResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||