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:
  • 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 a SimpleHttpClient record class.
      Parameters:
      acceptableCodes - the value for the acceptableCodes record component
      wrappedHttpClient - the value for the wrappedHttpClient record component
      requestExecutorService - the value for the requestExecutorService record component
      httpClientFactory - the value for the httpClientFactory record component
  • Method Details

    • sendMessageToEndPoint

      public boolean sendMessageToEndPoint(HttpMessage message)
      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 interface HttpClient
      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

      public HttpMessage sendMessageToEndPoint(URL url)
      Description copied from interface: HttpClient
      Contact the URL endpoint as a GET and return the resulting http message.
      Specified by:
      sendMessageToEndPoint in interface HttpClient
      Parameters:
      url - the url
      Returns:
      the http message
    • isValidEndPoint

      public boolean isValidEndPoint(String url)
      Description copied from interface: HttpClient
      Make a synchronous HTTP(S) call to ensure that the url is reachable.
      Specified by:
      isValidEndPoint in interface HttpClient
      Parameters:
      url - the url to call
      Returns:
      whether the url is valid
    • isValidEndPoint

      public boolean isValidEndPoint(URL url)
      Description copied from interface: HttpClient
      Make a synchronous HTTP(S) call to ensure that the url is reachable.
      Specified by:
      isValidEndPoint in interface HttpClient
      Parameters:
      url - the url to call
      Returns:
      whether the url is valid
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • acceptableCodes

      public List<Integer> acceptableCodes()
      Returns the value of the acceptableCodes 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 the wrappedHttpClient record component.
      Specified by:
      wrappedHttpClient in interface HttpClient
      Returns:
      the value of the wrappedHttpClient record component
    • requestExecutorService

      public org.apache.hc.client5.http.impl.classic.FutureRequestExecutionService requestExecutorService()
      Returns the value of the requestExecutorService record component.
      Returns:
      the value of the requestExecutorService record component
    • httpClientFactory

      public SimpleHttpClientFactoryBean httpClientFactory()
      Returns the value of the httpClientFactory record component.
      Specified by:
      httpClientFactory in interface HttpClient
      Returns:
      the value of the httpClientFactory record component