Package com.luciad.io.transport
Class TLcdTransportFactory
java.lang.Object
com.luciad.io.transport.TLcdTransportFactory
- All Implemented Interfaces:
ILcdTransportFactory
Default transport factory for HTTP transports, based on Apache's HttpClient library 5.4.1.
- Since:
- 2013.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a valid transport configuration that can be used to create a transport.Creates a new transport based on Apache's HttpClient library 5.4.1.createTransport(Object aConfiguration) Creates a transport using Apache'sHttpClient, with a transport configuration of typeCloseableHttpClient.intReturns the maximum number of cache entries for transports created by this factory.intGets the maximum number of connections per route.intGets the maximum number of total connections.intGets the number of times a request should be retried in case of an HTTP response containing429or503error response code.booleanTells whether or not HTTP caching is enabled for transports created by this factory.voidsetCaching(boolean aOn) Enables or disables caching for transports created by this factory.voidsetMaxCacheEntries(int aMaxCacheEntries) Setter for the maximum number of cache entries used by transports created by this factory.voidsetMaxConnectionsPerRoute(int aMaxConnectionsPerRoute) Sets the maximum number of connections per route.voidsetMaxTotalConnections(int aMaxTotalConnections) Sets the maximum number of total connections.voidsetRetryCount(int aRetryCount) Sets the number of times a request should be retried in case of an HTTP response containing429or503error response code.
-
Constructor Details
-
TLcdTransportFactory
public TLcdTransportFactory()
-
-
Method Details
-
createTransport
Creates a new transport based on Apache's HttpClient library 5.4.1.- Specified by:
createTransportin interfaceILcdTransportFactory- Returns:
- a new transport, never
null
-
isCaching
public boolean isCaching()Tells whether or not HTTP caching is enabled for transports created by this factory. When enabled, HTTP requests are cached. Default is disabled.- Returns:
trueif caching is enabled,falseotherwise- See Also:
-
setCaching
public void setCaching(boolean aOn) Enables or disables caching for transports created by this factory. Default is disabled.- Parameters:
aOn- whentrue, transports created by this factory will cache HTTP requests- See Also:
-
getMaxCacheEntries
public int getMaxCacheEntries()Returns the maximum number of cache entries for transports created by this factory. Sane values should be positive, but this factory does not enforce this. Default is 1000.- Returns:
- the maximum number of cache entries in the HTTP cache
- See Also:
-
setMaxCacheEntries
public void setMaxCacheEntries(int aMaxCacheEntries) Setter for the maximum number of cache entries used by transports created by this factory. For the purpose of BingMaps imagery, the objects that will be cached will be compressed (JPEG) Bing tiles. Default value is 1000.- Parameters:
aMaxCacheEntries- the maximum number of cache entries.- See Also:
-
getMaxConnectionsPerRoute
public int getMaxConnectionsPerRoute()Gets the maximum number of connections per route. The default is2. Negative values mean that the implementation's default will be used.- Returns:
- maximum number of connections per route
-
setMaxConnectionsPerRoute
public void setMaxConnectionsPerRoute(int aMaxConnectionsPerRoute) Sets the maximum number of connections per route. The default value is2. Negative values mean that the implementation's default will be used.- Parameters:
aMaxConnectionsPerRoute- the maximum number of connections per route
-
getMaxTotalConnections
public int getMaxTotalConnections()Gets the maximum number of total connections. The default is20. Negative values mean that the implementation's default will be used.- Returns:
- the maximum number of total connections
-
setMaxTotalConnections
public void setMaxTotalConnections(int aMaxTotalConnections) Sets the maximum number of total connections. The default is20. Negative values mean that the implementation's default will be used.- Parameters:
aMaxTotalConnections- the maximum number of total connections
-
setRetryCount
public void setRetryCount(int aRetryCount) Sets the number of times a request should be retried in case of an HTTP response containing429or503error response code. The default is0, meaning that requests will not be retried automatically. To enable automatic request retry, set this to a positive value. To disable automatic request retry, set this to0.- Parameters:
aRetryCount- the number of times a request should be retried in case of an HTTP response containing429or503error response code- Since:
- 2025.0
-
getRetryCount
public int getRetryCount()Gets the number of times a request should be retried in case of an HTTP response containing429or503error response code. The default is0, meaning that requests will not be retried automatically.- Returns:
- the number of times a request should be retried in case of an HTTP response
containing
429or503error response code - Since:
- 2025.0
- See Also:
-
createTransport
Creates a transport using Apache'sHttpClient, with a transport configuration of typeCloseableHttpClient. The transport configuration should have been created by an earlier call tocreateConfiguration().- Parameters:
aConfiguration- a transport configuration, which must be of typeCloseableHttpClient- Returns:
- a transport
- Throws:
IllegalArgumentException- if the transport configuration is incompatible with the transports created by this factory
-
createConfiguration
Creates a valid transport configuration that can be used to create a transport. This factory creates transport configurations of typeCloseableHttpClient. To customize the configuration, cast the object toCloseableHttpClientand configure it accordingly. In order to configure caching, you can use the methodssetCaching(boolean)andsetMaxCacheEntries(int)on this factory. If you want to customize caching even further, you can useCachingHttpClientBuilderto createCloseableHttpClientinstances capable of client-side caching yourself. If you do this, you should disable caching on this factory.If auto request retry is enabled, a client with a retry strategy is created. To configure auto request retry, use the method
setRetryCount(int)on this factory by passing a positive value. To disable auto request retry, set the count to0.- Returns:
- a valid transport configuration of type
CloseableHttpClient - See Also:
-