Class RetryWire

java.lang.Object
com.jcabi.http.wire.RetryWire
All Implemented Interfaces:
Wire

@Immutable public final class RetryWire extends Object implements Wire
Wire that retries a few times before giving up and throwing exception.

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.

Since:
0.10
  • Constructor Details

    • RetryWire

      public RetryWire(Wire wire)
      Public ctor.
      Parameters:
      wire - Original wire
  • Method Details