Class RetryableHttpStream

java.lang.Object
java.io.InputStream
org.jvnet.robust_http_client.RetryableHttpStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class RetryableHttpStream extends InputStream
InputStream implementation around HttpURLConnection that automatically reconnects if the connection fails in the middle.
Author:
Kohsuke Kawaguchi
  • Field Details

    • url

      public final URL url
      Where are we downloading from?
    • proxy

      protected final Proxy proxy
      Proxy, or null none is explicitly given (Java runtime may still decide to use a proxy, though.)
    • totalLength

      public final int totalLength
      Total bytes of the entity.
    • read

      protected int read
      Number of bytes read so far.
    • connection

      public final HttpURLConnection connection
      HttpURLConnection to allow the caller to access HTTP resposne headers. Do not use URLConnection.getInputStream(), however.
  • Constructor Details

    • RetryableHttpStream

      public RetryableHttpStream(URL url) throws IOException
      Connects to the given HTTP/HTTPS URL, by using the proxy auto-configured by the Java runtime.
      Throws:
      IOException
    • RetryableHttpStream

      public RetryableHttpStream(URL url, Proxy proxy) throws IOException
      Connects to the given HTTP/HTTPS URL, by using the specified proxy.
      Parameters:
      proxy - To force a direct connection, pass in Proxy.NO_PROXY.
      Throws:
      IOException
  • Method Details