@Immutable public final class OneMinuteWire extends Object implements Wire
IOException
if a request takes longer
than a minute.
It's recommended to use this decorator in production, in order to avoid stuck requests:
String html = new JdkRequest("http://goggle.com") .through(OneMinuteWire.class) .header(HttpHeaders.ACCEPT, MediaType.TEXT_PLAIN) .fetch() .body();
The class is immutable and thread-safe.
Constructor and Description |
---|
OneMinuteWire(Wire wire)
Public ctor.
|
Modifier and Type | Method and Description |
---|---|
Response |
send(Request req,
String home,
String method,
Collection<Map.Entry<String,String>> headers,
InputStream content,
int connect,
int read)
Send request and return response.
|
public OneMinuteWire(Wire wire)
wire
- Original wire@Timeable(limit=1, unit=MINUTES) public Response send(Request req, String home, String method, Collection<Map.Entry<String,String>> headers, InputStream content, int connect, int read) throws IOException
Wire
send
in interface Wire
req
- Requesthome
- URI to fetchmethod
- HTTP methodheaders
- Headerscontent
- HTTP bodyconnect
- The connect timeoutread
- The read timeoutIOException
- if failsCopyright © 2012–2017 jcabi.com. All rights reserved.