public final class SimpleHttpClient extends Object implements HttpClient, Serializable, org.springframework.beans.factory.DisposableBean
| Constructor and Description |
|---|
SimpleHttpClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Shutdown the executor service.
|
boolean |
isValidEndPoint(String url)
Make a synchronous HTTP(S) call to ensure that the url is reachable.
|
boolean |
isValidEndPoint(URL url)
Make a synchronous HTTP(S) call to ensure that the url is reachable.
|
boolean |
sendMessageToEndPoint(String url,
String message,
boolean async)
Sends a message to a particular endpoint.
|
void |
setAcceptableCodes(int[] acceptableCodes)
Set the acceptable HTTP status codes that we will use to determine if the
response from the URL was correct.
|
void |
setConnectionTimeout(int connectionTimeout)
Sets a specified timeout value, in milliseconds, to be used when opening the endpoint url.
|
void |
setExecutorService(ExecutorService executorService)
Note that changing this executor will affect all httpClients.
|
void |
setFollowRedirects(boolean follow)
Determines the behavior on receiving 3xx responses from HTTP endpoints.
|
void |
setHostnameVerifier(HostnameVerifier verifier)
Set the hostname verifier be used by the URL when submitting
request to check for URL endpoint validity.
|
void |
setReadTimeout(int readTimeout)
Sets a specified timeout value, in milliseconds, to be used when reading from the endpoint url.
|
void |
setSSLSocketFactory(SSLSocketFactory factory)
Set the SSL socket factory be used by the URL when submitting
request to check for URL endpoint validity.
|
public void setExecutorService(@NotNull
ExecutorService executorService)
executorService - The executor service to send messages to end points.public boolean sendMessageToEndPoint(String url, String message, boolean async)
This is useful when it doesn't matter about the response as you'll perform no action based on the response.
sendMessageToEndPoint in interface HttpClienturl - the url to send the message tomessage - the message itselfasync - true if you don't want to wait for the response, false otherwise.public boolean isValidEndPoint(String url)
isValidEndPoint in interface HttpClienturl - the url to callpublic boolean isValidEndPoint(URL url)
isValidEndPoint in interface HttpClienturl - the url to callpublic void setAcceptableCodes(int[] acceptableCodes)
acceptableCodes - an array of status code integers.public void setConnectionTimeout(int connectionTimeout)
connectionTimeout - specified timeout value in millisecondspublic void setReadTimeout(int readTimeout)
readTimeout - specified timeout value in millisecondspublic void setFollowRedirects(boolean follow)
follow - True to follow 3xx redirects (default), false otherwise.public void setSSLSocketFactory(SSLSocketFactory factory)
factory - ssl socket factory instance to useisValidEndPoint(URL)public void setHostnameVerifier(HostnameVerifier verifier)
verifier - hostname verifier instance to useisValidEndPoint(URL)Copyright © 2004-2014 Jasig. All Rights Reserved.