@Immutable public final class RetryWire extends Object implements Wire
This wire retries again (at least three times) if an original one throws
IOException:
String html = new JdkRequest("http://goggle.com")
.through(RetryWire.class)
.header(HttpHeaders.ACCEPT, MediaType.TEXT_PLAIN)
.fetch()
.body();
Since version 1.9 this wire retries also if HTTP status code is between 500 and 599.
The class is immutable and thread-safe.
| 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 RetryWire(Wire wire)
wire - Original wirepublic Response send(Request req, String home, String method, Collection<Map.Entry<String,String>> headers, InputStream content, int connect, int read) throws IOException
Wiresend in interface Wirereq - Requesthome - URI to fetchmethod - HTTP methodheaders - Headerscontent - HTTP bodyconnect - The connect timeoutread - The read timeoutIOException - if failsCopyright © 2012–2021 jcabi.com. All rights reserved.