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 boolean
exists
(URI uri, HttpFileSystemProviderSettings settings) Check if anURI
exists.static HttpClient
getClient
(HttpFileSystemProviderSettings settings) Get an HttpClient built wth appropriate settings.
-
Field Details
-
HTTP_PATH_SEPARATOR_STRING
SeparatorString
for path component of HTTP/S URL.- See Also:
-
HTTP_PATH_SEPARATOR_CHAR
public static final char HTTP_PATH_SEPARATOR_CHARSeparatorchar
for 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 anURI
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
Get an HttpClient built wth appropriate settings.- Parameters:
settings
- the settings to use for the client- Returns:
- a new HttpClient
-