Class TLcdTransportFactory

java.lang.Object
com.luciad.io.transport.TLcdTransportFactory
All Implemented Interfaces:
ILcdTransportFactory

public class TLcdTransportFactory extends Object implements ILcdTransportFactory
Default transport factory for HTTP transports, based on Apache's HttpClient library 5.4.1.
Since:
2013.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates 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's HttpClient, with a transport configuration of type CloseableHttpClient.
    int
    Returns the maximum number of cache entries for transports created by this factory.
    int
    Gets the maximum number of connections per route.
    int
    Gets the maximum number of total connections.
    int
    Gets the number of times a request should be retried in case of an HTTP response containing 429 or 503 error response code.
    boolean
    Tells whether or not HTTP caching is enabled for transports created by this factory.
    void
    setCaching(boolean aOn)
    Enables or disables caching for transports created by this factory.
    void
    setMaxCacheEntries(int aMaxCacheEntries)
    Setter for the maximum number of cache entries used by transports created by this factory.
    void
    setMaxConnectionsPerRoute(int aMaxConnectionsPerRoute)
    Sets the maximum number of connections per route.
    void
    setMaxTotalConnections(int aMaxTotalConnections)
    Sets the maximum number of total connections.
    void
    setRetryCount(int aRetryCount)
    Sets the number of times a request should be retried in case of an HTTP response containing 429 or 503 error response code.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TLcdTransportFactory

      public TLcdTransportFactory()
  • Method Details

    • createTransport

      public ILcdTransport createTransport()
      Creates a new transport based on Apache's HttpClient library 5.4.1.
      Specified by:
      createTransport in interface ILcdTransportFactory
      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:
      true if caching is enabled, false otherwise
      See Also:
    • setCaching

      public void setCaching(boolean aOn)
      Enables or disables caching for transports created by this factory. Default is disabled.
      Parameters:
      aOn - when true, 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 is 2. 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 is 2. 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 is 20. 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 is 20. 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 containing 429 or 503 error response code. The default is 0, 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 to 0.
      Parameters:
      aRetryCount - the number of times a request should be retried in case of an HTTP response containing 429 or 503 error 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 containing 429 or 503 error response code. The default is 0, 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 429 or 503 error response code
      Since:
      2025.0
      See Also:
    • createTransport

      public ILcdTransport createTransport(Object aConfiguration)
      Creates a transport using Apache's HttpClient, with a transport configuration of type CloseableHttpClient.

      The transport configuration should have been created by an earlier call to createConfiguration().

      Parameters:
      aConfiguration - a transport configuration, which must be of type CloseableHttpClient
      Returns:
      a transport
      Throws:
      IllegalArgumentException - if the transport configuration is incompatible with the transports created by this factory
    • createConfiguration

      public Object createConfiguration()
      Creates a valid transport configuration that can be used to create a transport. This factory creates transport configurations of type CloseableHttpClient.

      To customize the configuration, cast the object to CloseableHttpClient and configure it accordingly.

      In order to configure caching, you can use the methods setCaching(boolean) and setMaxCacheEntries(int) on this factory.

      If you want to customize caching even further, you can use CachingHttpClientBuilder to create CloseableHttpClient instances 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 to 0.

      Returns:
      a valid transport configuration of type CloseableHttpClient
      See Also: