|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--org.apache.cocoon.environment.http.HttpResponse
Implements the HttpServletResponse interface to provide HTTP-specific
functionality in sending a response. For example, it has methods
to access HTTP headers and cookies.
| Constructor Summary | |
protected |
HttpResponse(javax.servlet.http.HttpServletResponse res)
Creates a HttpServletResponse based on a real HttpServletResponse object |
| Method Summary | |
void |
addCookie(Cookie cookie)
Adds the specified cookie to the response. |
void |
addDateHeader(java.lang.String name,
long date)
Adds a response header with the given name and date-value. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds a response header with the given name and value. |
void |
addIntHeader(java.lang.String name,
int value)
Adds a response header with the given name and int value. |
boolean |
containsHeader(java.lang.String name)
Returns a boolean indicating whether the named response header has already been set. |
Cookie |
createCookie(java.lang.String name,
java.lang.String value)
Create a new cookie which is not added to the response |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated. As of version 2.1, use encodeRedirectURL(String url) instead |
java.lang.String |
encodeRedirectURL(java.lang.String url)
|
java.lang.String |
encodeUrl(java.lang.String url)
Deprecated. As of version 2.1, use encodeURL(String url) instead |
java.lang.String |
encodeURL(java.lang.String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
void |
flushBuffer()
|
int |
getBufferSize()
|
java.lang.String |
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. |
java.util.Locale |
getLocale()
Returns the locale assigned to the response. |
javax.servlet.ServletOutputStream |
getOutputStream()
|
java.io.PrintWriter |
getWriter()
|
boolean |
isCommitted()
|
void |
reset()
|
void |
sendError(int sc)
|
void |
sendError(int sc,
java.lang.String msg)
|
void |
sendRedirect(java.lang.String location)
|
void |
setBufferSize(int size)
|
void |
setContentLength(int len)
|
void |
setContentType(java.lang.String type)
|
void |
setDateHeader(java.lang.String name,
long date)
Sets a response header with the given name and date-value. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets a response header with the given name and value. |
void |
setIntHeader(java.lang.String name,
int value)
Sets a response header with the given name and int value. |
void |
setLocale(java.util.Locale loc)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
void |
setStatus(int sc)
|
void |
setStatus(int sc,
java.lang.String sm)
Deprecated. As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use setStatus(int), to send an error with a description
use sendError(int, String). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected HttpResponse(javax.servlet.http.HttpServletResponse res)
| Method Detail |
public Cookie createCookie(java.lang.String name,
java.lang.String value)
createCookie in interface Responseorg.apache.cocoon.environment.Responsename - a String specifying the name of the cookievalue - a String specifying the value of the cookiejava.lang.IllegalArgumentException - if the cookie name contains illegal characters
(for example, a comma, space, or semicolon)
or it is one of the tokens reserved for use
by the cookie protocolpublic void addCookie(Cookie cookie)
ResponseaddCookie in interface Responseorg.apache.cocoon.environment.Responsecookie - the Cookie to return to the clientpublic boolean containsHeader(java.lang.String name)
ResponsecontainsHeader in interface Responseorg.apache.cocoon.environment.Responsename - the header nametrue if the named response header
has already been set;
false otherwisepublic java.lang.String encodeURL(java.lang.String url)
ResponseFor robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
encodeURL in interface Responseorg.apache.cocoon.environment.Responseurl - the url to be encoded.public java.lang.String encodeRedirectURL(java.lang.String url)
public void sendError(int sc,
java.lang.String msg)
throws java.io.IOException
public void sendError(int sc)
throws java.io.IOException
public void sendRedirect(java.lang.String location)
throws java.io.IOException
public void setDateHeader(java.lang.String name,
long date)
ResponsecontainsHeader method can be used to test for the
presence of a header before setting its value.setDateHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the header to setdate - the assigned date valueResponse.containsHeader(java.lang.String),
Response.addDateHeader(java.lang.String, long)
public void addDateHeader(java.lang.String name,
long date)
ResponseaddDateHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the header to setdate - the additional date valueResponse.setDateHeader(java.lang.String, long)
public void setHeader(java.lang.String name,
java.lang.String value)
ResponsecontainsHeader method can be
used to test for the presence of a header before setting its
value.setHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the headervalue - the header valueResponse.containsHeader(java.lang.String),
Response.addHeader(java.lang.String, java.lang.String)
public void addHeader(java.lang.String name,
java.lang.String value)
ResponseaddHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the headervalue - the additional header valueResponse.setHeader(java.lang.String, java.lang.String)
public void setIntHeader(java.lang.String name,
int value)
ResponsecontainsHeader method can be used to test for the
presence of a header before setting its value.setIntHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the header to setvalue - the assigned int valueResponse.containsHeader(java.lang.String),
Response.addIntHeader(java.lang.String, int)
public void addIntHeader(java.lang.String name,
int value)
ResponseaddIntHeader in interface Responseorg.apache.cocoon.environment.Responsename - the name of the header to setvalue - the additional int valueResponse.setIntHeader(java.lang.String, int)public void setStatus(int sc)
public java.lang.String encodeUrl(java.lang.String url)
public java.lang.String encodeRedirectUrl(java.lang.String url)
public void setStatus(int sc,
java.lang.String sm)
setStatus(int), to send an error with a description
use sendError(int, String).
public java.lang.String getCharacterEncoding()
ResponseIf no charset has been assigned, it is implicitly
set to ISO-8859-1 (Latin-1).
See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt) for more information about character encoding and MIME.
getCharacterEncoding in interface Responseorg.apache.cocoon.environment.ResponseString specifying the
name of the charset, for
example, ISO-8859-1
public javax.servlet.ServletOutputStream getOutputStream()
throws java.io.IOException
public java.io.PrintWriter getWriter()
throws java.io.IOException
public void setContentLength(int len)
public void setContentType(java.lang.String type)
public void setBufferSize(int size)
public int getBufferSize()
public void flushBuffer()
throws java.io.IOException
public boolean isCommitted()
public void reset()
public void setLocale(java.util.Locale loc)
ResponsesetLocale in interface Responseorg.apache.cocoon.environment.Responseloc - the locale of the responseResponse.getLocale()public java.util.Locale getLocale()
ResponsegetLocale in interface Responseorg.apache.cocoon.environment.ResponseResponse.setLocale(java.util.Locale)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||