Class HttpUtils
java.lang.Object
org.broadinstitute.http.nio.utils.HttpUtils
Utility class for working with HTTP/S connections and URLs.
Includes also constants for HTTP/S.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanexists(URI uri, HttpFileSystemProviderSettings settings) Check if anURIexists.static HttpClientgetClient(HttpFileSystemProviderSettings settings) Get an HttpClient built wth appropriate settings.
-
Field Details
-
HTTP_PATH_SEPARATOR_STRING
SeparatorStringfor path component of HTTP/S URL.- See Also:
-
HTTP_PATH_SEPARATOR_CHAR
public static final char HTTP_PATH_SEPARATOR_CHARSeparatorcharfor path component of HTTP/S URL.- See Also:
-
HTTP_PATH_CHARSET
Charset for path component of HTTP/S URL.
-
-
Constructor Details
-
HttpUtils
private HttpUtils()
-
-
Method Details
-
exists
Check if anURIexists.A URI exists if the response code is 200 or 206 It does not exist of the response is 404 or an
UnresolvedAddressExceptionis thrown- Parameters:
uri- URI to test for existance.settings- the settings to use to build the http connections- Returns:
trueif the URL exists;falseotherwise.- Throws:
IOException- if an I/O error occurs.AccessDeniedException- on http 401, 403, 407
-
getClient
Get an HttpClient built wth appropriate settings.- Parameters:
settings- the settings to use for the client- Returns:
- a new HttpClient
-