Class HTTPFileRetriever

java.lang.Object
org.graylog2.lookup.adapters.dsvhttp.HTTPFileRetriever

public class HTTPFileRetriever extends Object
  • Constructor Details

    • HTTPFileRetriever

      @Inject public HTTPFileRetriever(okhttp3.OkHttpClient httpClient)
  • Method Details

    • fetchFile

      public Optional<String> fetchFile(String url) throws IOException
      Request file. No "If-Modified-Since" header will be sent so the file will be fetched again, even if hasn't been modified since the last fetch.
      Throws:
      IOException
    • fetchFileBytes

      public Optional<byte[]> fetchFileBytes(String url) throws IOException
      Request file bytes. No "If-Modified-Since" header will be sent so the file will be fetched again, even if hasn't been modified since the last fetch.
      Throws:
      IOException
    • downloadFile

      public boolean downloadFile(String url, Path toPath) throws IOException
      Request that a file be downloaded and stored to the provided location. No "If-Modified-Since" header will be sent so the file will be fetched again, even if it hasn't been modified since the last fetch.
      Throws:
      IOException
    • fetchFileIfNotModified

      public Optional<String> fetchFileIfNotModified(String url) throws IOException
      Request file by sending an "If-Modified-Since" header so that the file won't be fetched if it hasn't been modified since the last request.
      Throws:
      IOException
    • fetchFileBytesIfNotModified

      public Optional<byte[]> fetchFileBytesIfNotModified(String url) throws IOException
      Request file bytes by sending an "If-Modified-Since" header so that the file won't be fetched if it hasn't been modified since the last request.
      Throws:
      IOException
    • downloadFileIfNotModified

      public boolean downloadFileIfNotModified(String url, Path toPath) throws IOException
      Request that a file be downloaded and stored to the provided location. Will send the "If-Modified-Since" header so that the file won't be fetched if it hasn't been modified since the last request. Returns TRUE if the file was downloaded, FALSE otherwise.
      Throws:
      IOException