|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object org.jboss.netty.handler.codec.http.CookieEncoder
public class CookieEncoder
Encodes Cookie
s into an HTTP header value. This encoder can encode
the HTTP cookie version 0, 1, and 2.
This encoder is stateful. It maintains an internal data structure that
holds the Cookie
s added by the addCookie(String, String)
method. Once encode()
is called, all added Cookie
s are
encoded into an HTTP header value and all Cookie
s in the internal
data structure are removed so that the encoder can start over.
// Client-side exampleHttpRequest
req = ...;CookieEncoder
encoder = newCookieEncoder
(false); encoder.addCookie("JSESSIONID", "1234"); res.setHeader("Cookie", encoder.encode()); // Server-side exampleHttpResponse
res = ...;CookieEncoder
encoder = newCookieEncoder
(true); encoder.addCookie("JSESSIONID", "1234"); res.setHeader("Set-Cookie", encoder.encode());
CookieDecoder
构造方法摘要 | |
---|---|
CookieEncoder(boolean server)
Creates a new encoder. |
方法摘要 | |
---|---|
void |
addCookie(Cookie cookie)
Adds the specified Cookie to this encoder. |
void |
addCookie(java.lang.String name,
java.lang.String value)
Adds a new Cookie created with the specified name and value to
this encoder. |
java.lang.String |
encode()
Encodes the Cookie s which were added by addCookie(Cookie)
so far into an HTTP header value. |
从类 java.lang.Object 继承的方法 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public CookieEncoder(boolean server)
server
- true
if and only if this encoder is supposed to
encode server-side cookies. false
if and only if
this encoder is supposed to encode client-side cookies.方法详细信息 |
---|
public void addCookie(java.lang.String name, java.lang.String value)
Cookie
created with the specified name and value to
this encoder.
public void addCookie(Cookie cookie)
Cookie
to this encoder.
public java.lang.String encode()
Cookie
s which were added by addCookie(Cookie)
so far into an HTTP header value. If no Cookie
s were added,
an empty string is returned.
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |