@Immutable public final class CookieOptimizingWire extends Object implements Wire
This wire compresses all provided Cookie headers into one
and removes empty cookies, for example:
String html = new JdkRequest("http://goggle.com")
.through(CookieOptimizingWire.class)
.header(HttpHeaders.Cookie, "alpha=test")
.header(HttpHeaders.Cookie, "beta=")
.header(HttpHeaders.Cookie, "gamma=foo")
.fetch()
.body();
An actual HTTP request will be sent with just one Cookie
header with a value alpha=test; gamma=foo.
It is highly recommended to use this wire decorator when you're working with cookies.
The class is immutable and thread-safe.
| Constructor and Description |
|---|
CookieOptimizingWire(Wire wire)
Public ctor.
|
public Response send(Request req, String home, String method, Collection<Map.Entry<String,String>> headers, byte[] content) throws IOException
send in interface Wirereq - Requesthome - URI to fetchmethod - HTTP methodheaders - Headerscontent - HTTP bodyIOException - if failsCopyright © 2012–2014 jcabi.com. All rights reserved.