Class HttpUtils

java.lang.Object
org.broadinstitute.http.nio.utils.HttpUtils

public final class HttpUtils extends Object
Utility class for working with HTTP/S connections and URLs.

Includes also constants for HTTP/S.

  • Field Details

    • HTTP_PATH_SEPARATOR_STRING

      public static final String HTTP_PATH_SEPARATOR_STRING
      Separator String for path component of HTTP/S URL.
      See Also:
    • HTTP_PATH_SEPARATOR_CHAR

      public static final char HTTP_PATH_SEPARATOR_CHAR
      Separator char for path component of HTTP/S URL.
      See Also:
    • HTTP_PATH_CHARSET

      public static final Charset HTTP_PATH_CHARSET
      Charset for path component of HTTP/S URL.
  • Constructor Details

    • HttpUtils

      private HttpUtils()
  • Method Details

    • exists

      public static boolean exists(URI uri, HttpFileSystemProviderSettings settings) throws IOException
      Check if an URI exists.

      A URI exists if the response code is 200 or 206 It does not exist of the response is 404 or an UnresolvedAddressException is thrown

      Parameters:
      uri - URI to test for existance.
      settings - the settings to use to build the http connections
      Returns:
      true if the URL exists; false otherwise.
      Throws:
      IOException - if an I/O error occurs.
      AccessDeniedException - on http 401, 403, 407
    • getClient

      public static HttpClient getClient(HttpFileSystemProviderSettings settings)
      Get an HttpClient built wth appropriate settings.
      Parameters:
      settings - the settings to use for the client
      Returns:
      a new HttpClient