|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.environment.commandline.CommandLineResponse
public class CommandLineResponse
Creates a specific servlet response simulation from command line usage.
Constructor Summary | |
---|---|
CommandLineResponse()
|
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 locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommandLineResponse()
Method Detail |
---|
public String getCharacterEncoding()
Response
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.
getCharacterEncoding
in interface Response
String
specifying the
name of the charset, for
example, ISO-8859-1
public Cookie createCookie(String name, String value)
Response
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.
createCookie
in interface Response
name
- a String
specifying the name of the cookievalue
- a String
specifying the value of the cookiepublic void addCookie(Cookie cookie)
Response
addCookie
in interface Response
cookie
- the Cookie to return to the clientpublic boolean containsHeader(String name)
Response
containsHeader
in interface Response
name
- the header name
true
if the named response header
has already been set;
false
otherwisepublic void setHeader(String name, String value)
Response
containsHeader
method can be
used to test for the presence of a header before setting its
value.
setHeader
in interface Response
name
- the name of the headervalue
- the header valueResponse.containsHeader(String)
,
Response.addHeader(String, String)
public void setIntHeader(String name, int value)
Response
containsHeader
method can be used to test for the
presence of a header before setting its value.
setIntHeader
in interface Response
name
- the name of the header to setvalue
- the assigned int valueResponse.containsHeader(String)
,
Response.addIntHeader(String, int)
public void setDateHeader(String name, long date)
Response
containsHeader
method can be used to test for the
presence of a header before setting its value.
setDateHeader
in interface Response
name
- the name of the header to setdate
- the assigned date valueResponse.containsHeader(String)
,
Response.addDateHeader(String, long)
public String encodeURL(String url)
Response
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.
encodeURL
in interface Response
url
- the url to be encoded.
public void setLocale(Locale locale)
Response
setLocale
in interface Response
locale
- the locale of the responseResponse.getLocale()
public Locale getLocale()
Response
getLocale
in interface Response
Response.setLocale(Locale)
public void addDateHeader(String name, long date)
Response
addDateHeader
in interface Response
name
- the name of the header to setdate
- the additional date valueResponse.setDateHeader(String, long)
public void addHeader(String name, String value)
Response
addHeader
in interface Response
name
- the name of the headervalue
- the additional header valueResponse.setHeader(String, String)
public void addIntHeader(String name, int value)
Response
addIntHeader
in interface Response
name
- the name of the header to setvalue
- the additional int valueResponse.setIntHeader(String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |