|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Response
Defines an interface to provide client response information .
Method Summary | |
---|---|
void |
addCookie(Cookie cookie)
Adds the specified cookie to the response. |
void |
addDateHeader(String name,
long date)
Adds a response header with the given name and date-value. |
void |
addHeader(String name,
String value)
Adds a response header with the given name and value. |
void |
addIntHeader(String name,
int value)
Adds a response header with the given name and int value. |
boolean |
containsHeader(String name)
Returns a boolean indicating whether the named response header has already been set. |
Cookie |
createCookie(String name,
String value)
Constructs a cookie with a specified name and value. |
String |
encodeURL(String url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
String |
getCharacterEncoding()
Returns the name of the charset used for the MIME body sent in this response. |
Locale |
getLocale()
Returns the locale assigned to the response. |
void |
setDateHeader(String name,
long date)
Sets a response header with the given name and date-value. |
void |
setHeader(String name,
String value)
Sets a response header with the given name and value. |
void |
setIntHeader(String name,
int value)
Sets a response header with the given name and int value. |
void |
setLocale(Locale loc)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
Method Detail |
---|
String getCharacterEncoding()
If 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.
String
specifying the
name of the charset, for
example, ISO-8859-1
void setLocale(Locale loc)
loc
- the locale of the responsegetLocale()
Locale getLocale()
setLocale(Locale)
Cookie createCookie(String name, String value)
The name must conform to RFC 2109. That means it can contain only ASCII alphanumeric characters and cannot contain commas, semicolons, or white space or begin with a $ character. The cookie's name cannot be changed after creation.
The value can be anything the server chooses to send. Its
value is probably of interest only to the server. The cookie's
value can be changed after creation with the
setValue
method.
By default, cookies are created according to the Netscape
cookie specification. The version can be changed with the
setVersion
method.
name
- a String
specifying the name of the cookievalue
- a String
specifying the value of the cookie
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 protocolvoid addCookie(Cookie cookie)
cookie
- the Cookie to return to the clientboolean containsHeader(String name)
name
- the header name
true
if the named response header
has already been set;
false
otherwiseString encodeURL(String url)
For 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.
url
- the url to be encoded.
void setDateHeader(String name, long date)
containsHeader
method can be used to test for the
presence of a header before setting its value.
name
- the name of the header to setdate
- the assigned date valuecontainsHeader(String)
,
addDateHeader(String, long)
void addDateHeader(String name, long date)
name
- the name of the header to setdate
- the additional date valuesetDateHeader(String, long)
void setHeader(String name, String value)
containsHeader
method can be
used to test for the presence of a header before setting its
value.
name
- the name of the headervalue
- the header valuecontainsHeader(String)
,
addHeader(String, String)
void addHeader(String name, String value)
name
- the name of the headervalue
- the additional header valuesetHeader(String, String)
void setIntHeader(String name, int value)
containsHeader
method can be used to test for the
presence of a header before setting its value.
name
- the name of the header to setvalue
- the assigned int valuecontainsHeader(String)
,
addIntHeader(String, int)
void addIntHeader(String name, int value)
name
- the name of the header to setvalue
- the additional int valuesetIntHeader(String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |