| Constructor and Description |
|---|
Get() |
| Modifier and Type | Method and Description |
|---|---|
SimpleResponse |
get(String location)
Make an HTTP GET request
|
void |
setConnectTimeout(int connectTimeout)
Sets a specified timeout value, in milliseconds, to be used by
the underlying URLConnection when opening a communications link to the resource referenced
by the URLConnection.
|
void |
setHostnameVerifier(HostnameVerifier hostnameVerifier)
Sets the HostnameVerifier used by the underlying HttpsURLConnection.
|
void |
setHttpProxy(Proxy proxy)
Sets the Proxy through which the connection will be made with
URL.openConnection(Proxy). |
void |
setInitialRetryWaitTime(long initialRetryWaitTime)
Sets the initial wait time for retry requests.
|
void |
setProgressiveRetryWait(boolean progressiveRetryWait)
Sets whether a progressively longer wait time should be used between retry attempts (up to a max of 8000).
|
void |
setReadTimeout(int readTimeout)
Sets the read timeout to the specified value, in
milliseconds, for the underlying URLConnection.
|
void |
setResponseBodySizeLimit(int responseBodySizeLimit)
Sets a limit on the size of the response body that will be consumed.
|
void |
setRetries(int retries)
Sets the number times to retry in the case of a request that failed for a reason
that potently could be recovered from.
|
void |
setSslSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the SSLSocketFactory to used when creating sockets for HTTPS connections, which allows
for control over the details of creating and initially configuring the secure sockets such
as setting authentication keys, peer certificate validation, enabled cipher suites, and so on.
|
void |
setTrustedCertificates(Collection<X509Certificate> certificates)
Sets the certificates that will be used by the underlying HttpsURLConnection as trust anchors when validating the HTTPS certificate presented by the server.
|
void |
setTrustedCertificates(X509Certificate... certificates)
|
public SimpleResponse get(String location) throws IOException
SimpleGetget in interface SimpleGetlocation - the HTTP(S) URLIOException - if a problem occurs with the requestpublic void setConnectTimeout(int connectTimeout)
connectTimeout - the timeout value to be used in millisecondspublic void setReadTimeout(int readTimeout)
readTimeout - the timeout value to be used in millisecondspublic void setHostnameVerifier(HostnameVerifier hostnameVerifier)
hostnameVerifier - the host name verifierpublic void setTrustedCertificates(X509Certificate... certificates)
certificates - certificates to trustpublic void setRetries(int retries)
retries - the number of times to retrypublic void setProgressiveRetryWait(boolean progressiveRetryWait)
progressiveRetryWait - true for a progressively longer retry wait time, false for a static retry wait timepublic void setInitialRetryWaitTime(long initialRetryWaitTime)
initialRetryWaitTime - wait time in millisecondspublic void setResponseBodySizeLimit(int responseBodySizeLimit)
responseBodySizeLimit - size limit of the response body in number of characters, -1 indicates no limitpublic void setTrustedCertificates(Collection<X509Certificate> certificates)
Note that only one of setSslSocketFactory(SSLSocketFactory) or setTrustedCertificates(Collection)
or setTrustedCertificates(X509Certificate...) should be used
per instance of this class as each results in the setting of the underlying SSLSocketFactory used by the HttpsURLConnection and the last
method to be called will effectively override
the others.
certificates - certificates to trustpublic void setSslSocketFactory(SSLSocketFactory sslSocketFactory)
Sets the SSLSocketFactory to used when creating sockets for HTTPS connections, which allows for control over the details of creating and initially configuring the secure sockets such as setting authentication keys, peer certificate validation, enabled cipher suites, and so on.
Note that only one of setSslSocketFactory(SSLSocketFactory) or setTrustedCertificates(Collection)
or setTrustedCertificates(X509Certificate...) should be used
per instance of this class as each results in the setting of the underlying SSLSocketFactory used by the HttpsURLConnection and the last
method to be called will effectively override
the others.
sslSocketFactory - the SSLSocketFactorypublic void setHttpProxy(Proxy proxy)
URL.openConnection(Proxy).
By default no Proxy is used when making the connection - e.g. just URL.openConnection().proxy - the Proxy through which the connection will be madeCopyright © 2022. All rights reserved.