com.ning.org.jboss.netty.handler.codec.http
Class CookieEncoder
java.lang.Object
com.ning.org.jboss.netty.handler.codec.http.CookieEncoder
public final class CookieEncoder
- extends Object
Encodes Cookies 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 Cookies added by the #addCookie(String, String)
method. Once #encode() is called, all added Cookies are
encoded into an HTTP header value and all Cookies in the internal
data structure are removed so that the encoder can start over.
// Client-side example
HttpRequest req = ...;
CookieEncoder encoder = new CookieEncoder(false);
encoder.addCookie("JSESSIONID", "1234");
res.setHeader("Cookie", encoder.encode());
// Server-side example
HttpResponse res = ...;
CookieEncoder encoder = new CookieEncoder(true);
encoder.addCookie("JSESSIONID", "1234");
res.setHeader("Set-Cookie", encoder.encode());
- See Also:
CookieDecoder
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
encodeClientSide
public static String encodeClientSide(Collection<Cookie> cookies,
boolean useRFC6265Style)
Copyright © 2014. All Rights Reserved.