Class SimpleHttpClientFactoryBean

java.lang.Object
org.apereo.cas.util.http.SimpleHttpClientFactoryBean
All Implemented Interfaces:
HttpClientFactory, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean
Direct Known Subclasses:
SimpleHttpClientFactoryBean.DefaultHttpClient

public class SimpleHttpClientFactoryBean extends Object implements HttpClientFactory
The factory to build a SimpleHttpClient.
Since:
4.1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The default http client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Max connections per route.

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    List of HTTP status codes considered valid by the caller.
    org.apache.hc.client5.http.classic.ConnectionBackoffStrategy
    When managing a dynamic number of connections for a given route, this strategy assesses whether a given request execution outcome should result in a backoff signal or not, based on either examining the Throwable that resulted or by examining the resulting response (e.g.
    org.apache.hc.client5.http.ConnectionKeepAliveStrategy
    Interface for deciding how long a connection can remain idle before being reused.
    org.apache.hc.core5.http.ConnectionReuseStrategy
    Interface for deciding whether a connection can be re-used for subsequent requests and should be kept alive.
    long
    Gets connection timeout.
    org.apache.hc.client5.http.cookie.CookieStore
    The cookie store for authentication.
    org.apache.hc.client5.http.auth.CredentialsProvider
    The credentials provider for endpoints that require authentication.
    Collection<? extends org.apache.hc.core5.http.Header>
    Default headers to be sent.
    The executor service used to create a buildRequestExecutorService(org.apache.hc.client5.http.impl.classic.CloseableHttpClient).
    The hostname verifier to be used when verifying the validity of the endpoint.
    int
    The Max connections per each route connections.
    int
    The Max pooled connections.
     
     
    org.apache.hc.core5.http.HttpHost
    Gets proxy.
    org.apache.hc.client5.http.AuthenticationStrategy
    Default strategy implementation for proxy host authentication.
    org.apache.hc.client5.http.protocol.RedirectStrategy
    The redirection strategy by default, using http status codes.
    long
     
    org.apache.hc.client5.http.HttpRequestRetryStrategy
    Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be retried and so on.
    long
     
    The CAS SSL context used to create ssl socket factories, etc.
    org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory
    The socket factory to be used when verifying the validity of the endpoint.
    X509 trust managers.
    boolean
    Determines whether authentication should be handled automatically.
    boolean
    Determines whether circular redirects (redirects to the same location) should be allowed.
    boolean
    Determines whether redirects should be handled automatically.
    boolean
     
    void
    setAcceptableCodes(List<Integer> acceptableCodes)
    List of HTTP status codes considered valid by the caller.
    void
    setAuthenticationEnabled(boolean authenticationEnabled)
    Determines whether authentication should be handled automatically.
    void
    setCircularRedirectsAllowed(boolean circularRedirectsAllowed)
    Determines whether circular redirects (redirects to the same location) should be allowed.
    void
    setConnectionBackoffStrategy(org.apache.hc.client5.http.classic.ConnectionBackoffStrategy connectionBackoffStrategy)
    When managing a dynamic number of connections for a given route, this strategy assesses whether a given request execution outcome should result in a backoff signal or not, based on either examining the Throwable that resulted or by examining the resulting response (e.g.
    void
    setConnectionKeepAliveStrategy(org.apache.hc.client5.http.ConnectionKeepAliveStrategy connectionKeepAliveStrategy)
    Interface for deciding how long a connection can remain idle before being reused.
    void
    setConnectionReuseStrategy(org.apache.hc.core5.http.ConnectionReuseStrategy connectionReuseStrategy)
    Interface for deciding whether a connection can be re-used for subsequent requests and should be kept alive.
    void
    setConnectionTimeout(long connectionTimeout)
     
    void
    setCookieStore(org.apache.hc.client5.http.cookie.CookieStore cookieStore)
    The cookie store for authentication.
    void
    setCredentialsProvider(org.apache.hc.client5.http.auth.CredentialsProvider credentialsProvider)
    The credentials provider for endpoints that require authentication.
    void
    setDefaultHeaders(Collection<? extends org.apache.hc.core5.http.Header> defaultHeaders)
    Default headers to be sent.
    void
    The executor service used to create a buildRequestExecutorService(org.apache.hc.client5.http.impl.classic.CloseableHttpClient).
    void
    The hostname verifier to be used when verifying the validity of the endpoint.
    void
    setMaxConnectionsPerRoute(int maxConnectionsPerRoute)
    The Max connections per each route connections.
    void
    setMaxPooledConnections(int maxPooledConnections)
    The Max pooled connections.
    void
    setProxy(org.apache.hc.core5.http.HttpHost proxy)
     
    void
    setProxyAuthenticationStrategy(org.apache.hc.client5.http.AuthenticationStrategy proxyAuthenticationStrategy)
    Default strategy implementation for proxy host authentication.
    void
    setRedirectionStrategy(org.apache.hc.client5.http.protocol.RedirectStrategy redirectionStrategy)
    The redirection strategy by default, using http status codes.
    void
    setRedirectsEnabled(boolean redirectsEnabled)
    Determines whether redirects should be handled automatically.
    void
    setResponseTimeout(long responseTimeout)
     
    void
    setRetryStrategy(org.apache.hc.client5.http.HttpRequestRetryStrategy retryStrategy)
    Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be retried and so on.
    void
    setSocketTimeout(long socketTimeout)
     
    void
    The CAS SSL context used to create ssl socket factories, etc.
    void
    setSslSocketFactory(org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory sslSocketFactory)
    The socket factory to be used when verifying the validity of the endpoint.
    void
    setTrustManagers(TrustManager[] trustManagers)
    X509 trust managers.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_CONNECTIONS_PER_ROUTE

      public static final int MAX_CONNECTIONS_PER_ROUTE
      Max connections per route.
      See Also:
  • Constructor Details

    • SimpleHttpClientFactoryBean

      public SimpleHttpClientFactoryBean()
  • Method Details

    • getObject

      public SimpleHttpClient getObject()
      Specified by:
      getObject in interface org.springframework.beans.factory.FactoryBean
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface org.springframework.beans.factory.FactoryBean
    • destroy

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

      public void setMaxPooledConnections(int maxPooledConnections)
      The Max pooled connections.
    • setMaxConnectionsPerRoute

      public void setMaxConnectionsPerRoute(int maxConnectionsPerRoute)
      The Max connections per each route connections.
    • setAcceptableCodes

      public void setAcceptableCodes(List<Integer> acceptableCodes)
      List of HTTP status codes considered valid by the caller.
    • setConnectionTimeout

      public void setConnectionTimeout(long connectionTimeout)
    • setSocketTimeout

      public void setSocketTimeout(long socketTimeout)
    • setResponseTimeout

      public void setResponseTimeout(long responseTimeout)
    • setRedirectionStrategy

      public void setRedirectionStrategy(org.apache.hc.client5.http.protocol.RedirectStrategy redirectionStrategy)
      The redirection strategy by default, using http status codes.
    • setSslSocketFactory

      public void setSslSocketFactory(org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory sslSocketFactory)
      The socket factory to be used when verifying the validity of the endpoint.
    • setHostnameVerifier

      public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
      The hostname verifier to be used when verifying the validity of the endpoint.
    • setSslContext

      public void setSslContext(SSLContext sslContext)
      The CAS SSL context used to create ssl socket factories, etc.
    • setTrustManagers

      public void setTrustManagers(TrustManager[] trustManagers)
      X509 trust managers.
    • setCredentialsProvider

      public void setCredentialsProvider(org.apache.hc.client5.http.auth.CredentialsProvider credentialsProvider)
      The credentials provider for endpoints that require authentication.
    • setCookieStore

      public void setCookieStore(org.apache.hc.client5.http.cookie.CookieStore cookieStore)
      The cookie store for authentication.
    • setConnectionReuseStrategy

      public void setConnectionReuseStrategy(org.apache.hc.core5.http.ConnectionReuseStrategy connectionReuseStrategy)
      Interface for deciding whether a connection can be re-used for subsequent requests and should be kept alive.
    • setConnectionKeepAliveStrategy

      public void setConnectionKeepAliveStrategy(org.apache.hc.client5.http.ConnectionKeepAliveStrategy connectionKeepAliveStrategy)
      Interface for deciding how long a connection can remain idle before being reused.
    • setConnectionBackoffStrategy

      public void setConnectionBackoffStrategy(org.apache.hc.client5.http.classic.ConnectionBackoffStrategy connectionBackoffStrategy)
      When managing a dynamic number of connections for a given route, this strategy assesses whether a given request execution outcome should result in a backoff signal or not, based on either examining the Throwable that resulted or by examining the resulting response (e.g. for its status code).
    • setRetryStrategy

      public void setRetryStrategy(org.apache.hc.client5.http.HttpRequestRetryStrategy retryStrategy)
      Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be retried and so on.
    • setDefaultHeaders

      public void setDefaultHeaders(Collection<? extends org.apache.hc.core5.http.Header> defaultHeaders)
      Default headers to be sent.
    • setProxyAuthenticationStrategy

      public void setProxyAuthenticationStrategy(org.apache.hc.client5.http.AuthenticationStrategy proxyAuthenticationStrategy)
      Default strategy implementation for proxy host authentication.
    • setCircularRedirectsAllowed

      public void setCircularRedirectsAllowed(boolean circularRedirectsAllowed)
      Determines whether circular redirects (redirects to the same location) should be allowed.
    • setAuthenticationEnabled

      public void setAuthenticationEnabled(boolean authenticationEnabled)
      Determines whether authentication should be handled automatically.
    • setRedirectsEnabled

      public void setRedirectsEnabled(boolean redirectsEnabled)
      Determines whether redirects should be handled automatically.
    • setExecutorService

      public void setExecutorService(ExecutorService executorService)
      The executor service used to create a buildRequestExecutorService(org.apache.hc.client5.http.impl.classic.CloseableHttpClient).
    • setProxy

      public void setProxy(org.apache.hc.core5.http.HttpHost proxy)
    • getMaxPooledConnections

      public int getMaxPooledConnections()
      The Max pooled connections.
    • getMaxConnectionsPerRoute

      public int getMaxConnectionsPerRoute()
      The Max connections per each route connections.
    • getAcceptableCodes

      public List<Integer> getAcceptableCodes()
      List of HTTP status codes considered valid by the caller.
    • getConnectionTimeout

      public long getConnectionTimeout()
      Description copied from interface: HttpClientFactory
      Gets connection timeout.
      Specified by:
      getConnectionTimeout in interface HttpClientFactory
      Returns:
      the connection timeout
    • getSocketTimeout

      public long getSocketTimeout()
    • getResponseTimeout

      public long getResponseTimeout()
    • getRedirectionStrategy

      public org.apache.hc.client5.http.protocol.RedirectStrategy getRedirectionStrategy()
      The redirection strategy by default, using http status codes.
    • getSslSocketFactory

      public org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory getSslSocketFactory()
      The socket factory to be used when verifying the validity of the endpoint.
      Specified by:
      getSslSocketFactory in interface HttpClientFactory
      Returns:
      the ssl socket factory
    • getHostnameVerifier

      public HostnameVerifier getHostnameVerifier()
      The hostname verifier to be used when verifying the validity of the endpoint.
      Specified by:
      getHostnameVerifier in interface HttpClientFactory
      Returns:
      the hostname verifier
    • getSslContext

      public SSLContext getSslContext()
      The CAS SSL context used to create ssl socket factories, etc.
      Specified by:
      getSslContext in interface HttpClientFactory
      Returns:
      the ssl context
    • getTrustManagers

      public TrustManager[] getTrustManagers()
      X509 trust managers.
      Specified by:
      getTrustManagers in interface HttpClientFactory
      Returns:
      the trust manager []
    • getCredentialsProvider

      public org.apache.hc.client5.http.auth.CredentialsProvider getCredentialsProvider()
      The credentials provider for endpoints that require authentication.
    • getCookieStore

      public org.apache.hc.client5.http.cookie.CookieStore getCookieStore()
      The cookie store for authentication.
    • getConnectionReuseStrategy

      public org.apache.hc.core5.http.ConnectionReuseStrategy getConnectionReuseStrategy()
      Interface for deciding whether a connection can be re-used for subsequent requests and should be kept alive.
    • getConnectionKeepAliveStrategy

      public org.apache.hc.client5.http.ConnectionKeepAliveStrategy getConnectionKeepAliveStrategy()
      Interface for deciding how long a connection can remain idle before being reused.
    • getConnectionBackoffStrategy

      public org.apache.hc.client5.http.classic.ConnectionBackoffStrategy getConnectionBackoffStrategy()
      When managing a dynamic number of connections for a given route, this strategy assesses whether a given request execution outcome should result in a backoff signal or not, based on either examining the Throwable that resulted or by examining the resulting response (e.g. for its status code).
    • getRetryStrategy

      public org.apache.hc.client5.http.HttpRequestRetryStrategy getRetryStrategy()
      Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be retried and so on.
    • getDefaultHeaders

      public Collection<? extends org.apache.hc.core5.http.Header> getDefaultHeaders()
      Default headers to be sent.
    • getProxyAuthenticationStrategy

      public org.apache.hc.client5.http.AuthenticationStrategy getProxyAuthenticationStrategy()
      Default strategy implementation for proxy host authentication.
    • isCircularRedirectsAllowed

      public boolean isCircularRedirectsAllowed()
      Determines whether circular redirects (redirects to the same location) should be allowed.
    • isAuthenticationEnabled

      public boolean isAuthenticationEnabled()
      Determines whether authentication should be handled automatically.
    • isRedirectsEnabled

      public boolean isRedirectsEnabled()
      Determines whether redirects should be handled automatically.
    • getExecutorService

      public ExecutorService getExecutorService()
      The executor service used to create a buildRequestExecutorService(org.apache.hc.client5.http.impl.classic.CloseableHttpClient).
    • getProxy

      public org.apache.hc.core5.http.HttpHost getProxy()
      Description copied from interface: HttpClientFactory
      Gets proxy.
      Specified by:
      getProxy in interface HttpClientFactory
      Returns:
      the proxy