Package net.shibboleth.shared.spring.httpclient.factory

# Class InMemoryCachingHttpClientFactoryBean

java.lang.Object
net.shibboleth.shared.httpclient.HttpClientBuilder
net.shibboleth.shared.httpclient.InMemoryCachingHttpClientBuilder
net.shibboleth.shared.spring.httpclient.factory.InMemoryCachingHttpClientFactoryBean

All Implemented Interfaces:
  `FactoryBean<org.apache.hc.client5.http.classic.HttpClient>`

public class InMemoryCachingHttpClientFactoryBean extends InMemoryCachingHttpClientBuilder implements FactoryBean<org.apache.hc.client5.http.classic.HttpClient>
Factory bean version of `InMemoryCachingHttpClientBuilder`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`singleton`
Singleton flag.
`private org.apache.hc.client5.http.classic.HttpClient`
`singletonInstance`
Our captive client in singleton cases.

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

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`InMemoryCachingHttpClientFactoryBean()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`org.apache.hc.client5.http.classic.HttpClient`
`getObject()`
`Class<org.apache.hc.client5.http.classic.HttpClient>`
`getObjectType()`
`boolean`
`isSingleton()`
`void`
`setSingleton(boolean flag)`
Set if a singleton should be created, or a new object on each request otherwise.

### Methods inherited from class net.shibboleth.shared.httpclient.InMemoryCachingHttpClientBuilder

`decorateApacheBuilder, getMaxCacheEntries, getMaxCacheEntrySize, setMaxCacheEntries, setMaxCacheEntrySize`

### Methods inherited from class net.shibboleth.shared.httpclient.HttpClientBuilder

`buildClient, buildConnectionFactory, buildConnectionManager, buildDefaultConnectionConfig, buildDefaultCredentialsProvider, buildDefaultRequestConfig, buildRoutePlanner, getConnectionProxyHost, getConnectionProxyPassword, getConnectionProxyPort, getConnectionProxyUsername, getConnectionRequestTimeout, getConnectionTimeout, getFirstRequestInterceptors, getFirstResponseInterceptors, getHttpContentCharSet, getHttpRequestRetryStrategy, getLastRequestInterceptors, getLastResponseInterceptors, getMaxConnectionsPerRoute, getMaxConnectionsTotal, getRequestTimeout, getRequestTimeoutCorePoolSize, getResponseTimeout, getSchemePortResolver, getSocketBufferSize, getSocketLocalAddress, getSocketTimeout, getStaticContextHandlers, getTLSSocketFactory, getUserAgent, handleFluentProperties, isConnectionCloseAfterResponse, isConnectionDisregardTLSCertificate, isDisableAuthCaching, isDisableAutomaticRetries, isDisableConnectionState, isDisableContentCompression, isDisableCookieManagement, isDisableRedirectHandling, isEvictExpiredConnections, isEvictIdleConnections, isHttpFollowRedirects, isUseSystemProperties, resetDefaults, setConnectionCloseAfterResponse, setConnectionDisregardTLSCertificate, setConnectionMaxIdleTime, setConnectionProxyHost, setConnectionProxyPassword, setConnectionProxyPort, setConnectionProxyUsername, setConnectionRequestTimeout, setConnectionTimeout, setDisableAuthCaching, setDisableAutomaticRetries, setDisableConnectionState, setDisableContentCompression, setDisableCookieManagement, setDisableRedirectHandling, setEvictExpiredConnections, setEvictIdleConnections, setFirstRequestInterceptors, setFirstResponseInterceptors, setHttpContentCharSet, setHttpFollowRedirects, setHttpRequestRetryStrategy, setLastRequestInterceptors, setLastResponseInterceptors, setMaxConnectionsPerRoute, setMaxConnectionsTotal, setRequestTimeout, setRequestTimeoutCorePoolSize, setResponseTimeout, setSchemePortResolver, setSocketBufferSize, setSocketLocalAddress, setSocketLocalAddress, setSocketTimeout, setStaticContextHandlers, setTLSSocketFactory, setUserAgent, setUseSystemProperties, setValidateAfterInactivity`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### singleton

private boolean singleton
Singleton flag.

### singletonInstance

@Nullable private org.apache.hc.client5.http.classic.HttpClient singletonInstance
Our captive client in singleton cases.

## Constructor Details

### InMemoryCachingHttpClientFactoryBean

public InMemoryCachingHttpClientFactoryBean()
Constructor.

## Method Details

### setSingleton

public void setSingleton(boolean flag)
Set if a singleton should be created, or a new object on each request otherwise. Default is `true` (a singleton).

Parameters:
  `flag` - flag to set

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `FactoryBean<org.apache.hc.client5.http.classic.HttpClient>`

### getObjectType

@Nonnull public Class<org.apache.hc.client5.http.classic.HttpClient> getObjectType()

Specified by:
  `getObjectType` in interface `FactoryBean<org.apache.hc.client5.http.classic.HttpClient>`

### getObject

@Nonnull public org.apache.hc.client5.http.classic.HttpClient getObject() throws Exception

Specified by:
  `getObject` in interface `FactoryBean<org.apache.hc.client5.http.classic.HttpClient>`
Throws:
  `Exception`