Package org.apereo.cas.util.http
Record Class SimpleHttpClient
java.lang.Object
java.lang.Record
org.apereo.cas.util.http.SimpleHttpClient
- All Implemented Interfaces:
Serializable
,HttpClient
,org.springframework.beans.factory.DisposableBean
public record SimpleHttpClient(List<Integer> acceptableCodes, org.apache.hc.client5.http.impl.classic.CloseableHttpClient wrappedHttpClient, org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService requestExecutorService, SimpleHttpClientFactoryBean httpClientFactory)
extends Record
implements HttpClient, Serializable, org.springframework.beans.factory.DisposableBean
Implementation of CAS
HttpClient
which delegates requests to a wrappedHttpClient
instance.- Since:
- 3.1
- See Also:
-
Field Summary
Fields inherited from interface org.apereo.cas.util.http.HttpClient
BEAN_NAME_HTTPCLIENT, BEAN_NAME_HTTPCLIENT_NO_REDIRECT, BEAN_NAME_HTTPCLIENT_TRUST_STORE
-
Constructor Summary
ConstructorDescriptionSimpleHttpClient
(List<Integer> acceptableCodes, org.apache.hc.client5.http.impl.classic.CloseableHttpClient wrappedHttpClient, org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService requestExecutorService, SimpleHttpClientFactoryBean httpClientFactory) Creates an instance of aSimpleHttpClient
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theacceptableCodes
record component.void
destroy()
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of thehttpClientFactory
record component.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.org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService
Returns the value of therequestExecutorService
record component.sendMessageToEndPoint
(URL url) Contact the URL endpoint as a GET and return the resulting http message.boolean
sendMessageToEndPoint
(HttpMessage message) Sends a message to a particular endpoint.final String
toString()
Returns a string representation of this record class.org.apache.hc.client5.http.impl.classic.CloseableHttpClient
Returns the value of thewrappedHttpClient
record component.
-
Constructor Details
-
SimpleHttpClient
public SimpleHttpClient(List<Integer> acceptableCodes, org.apache.hc.client5.http.impl.classic.CloseableHttpClient wrappedHttpClient, org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService requestExecutorService, SimpleHttpClientFactoryBean httpClientFactory) Creates an instance of aSimpleHttpClient
record class.- Parameters:
acceptableCodes
- the value for theacceptableCodes
record componentwrappedHttpClient
- the value for thewrappedHttpClient
record componentrequestExecutorService
- the value for therequestExecutorService
record componenthttpClientFactory
- the value for thehttpClientFactory
record component
-
-
Method Details
-
sendMessageToEndPoint
Description copied from interface:HttpClient
Sends a message to a particular endpoint. Option of sending it without waiting to ensure a response was returned. This is useful when it doesn't matter about the response as you'll perform no action based on the response.- Specified by:
sendMessageToEndPoint
in interfaceHttpClient
- Parameters:
message
- The message that should be sent to the http endpoint- Returns:
- boolean if the message was sent, or async was used. false if the message failed.
-
sendMessageToEndPoint
Description copied from interface:HttpClient
Contact the URL endpoint as a GET and return the resulting http message.- Specified by:
sendMessageToEndPoint
in interfaceHttpClient
- Parameters:
url
- the url- Returns:
- the http message
-
isValidEndPoint
Description copied from interface:HttpClient
Make a synchronous HTTP(S) call to ensure that the url is reachable.- Specified by:
isValidEndPoint
in interfaceHttpClient
- Parameters:
url
- the url to call- Returns:
- whether the url is valid
-
isValidEndPoint
Description copied from interface:HttpClient
Make a synchronous HTTP(S) call to ensure that the url is reachable.- Specified by:
isValidEndPoint
in interfaceHttpClient
- Parameters:
url
- the url to call- Returns:
- whether the url is valid
-
destroy
public void destroy()- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
acceptableCodes
Returns the value of theacceptableCodes
record component.- Returns:
- the value of the
acceptableCodes
record component
-
wrappedHttpClient
public org.apache.hc.client5.http.impl.classic.CloseableHttpClient wrappedHttpClient()Returns the value of thewrappedHttpClient
record component.- Specified by:
wrappedHttpClient
in interfaceHttpClient
- Returns:
- the value of the
wrappedHttpClient
record component
-
requestExecutorService
public org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService requestExecutorService()Returns the value of therequestExecutorService
record component.- Returns:
- the value of the
requestExecutorService
record component
-
httpClientFactory
Returns the value of thehttpClientFactory
record component.- Specified by:
httpClientFactory
in interfaceHttpClient
- Returns:
- the value of the
httpClientFactory
record component
-