Class AhcComponent

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.CamelContextAware, org.apache.camel.Component, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HeaderFilterStrategyAware, org.apache.camel.SSLContextParametersAware, org.apache.camel.StatefulService, org.apache.camel.SuspendableService

    @Component("ahc")
    public class AhcComponent
    extends org.apache.camel.support.HeaderFilterStrategyComponent
    implements org.apache.camel.SSLContextParametersAware
    To call external HTTP services using Async Http Client
    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Constructor Summary

      Constructors 
      Constructor Description
      AhcComponent()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected String createAddressUri​(String uri, String remaining)  
      protected AhcEndpoint createAhcEndpoint​(String endpointUri, AhcComponent component, URI httpUri)  
      protected org.apache.camel.Endpoint createEndpoint​(String uri, String remaining, Map<String,​Object> parameters)  
      AhcBinding getBinding()  
      org.asynchttpclient.AsyncHttpClient getClient()  
      org.asynchttpclient.AsyncHttpClientConfig getClientConfig()  
      org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()  
      boolean isAllowJavaSerializedObject()  
      boolean isUseGlobalSslContextParameters()  
      void setAllowJavaSerializedObject​(boolean allowJavaSerializedObject)
      Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object
      void setBinding​(AhcBinding binding)
      To use a custom AhcBinding which allows to control how to bind between AHC and Camel.
      void setClient​(org.asynchttpclient.AsyncHttpClient client)
      To use a custom AsyncHttpClient
      void setClientConfig​(org.asynchttpclient.AsyncHttpClientConfig clientConfig)
      To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance.
      void setSslContextParameters​(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
      Reference to a org.apache.camel.support.jsse.SSLContextParameters in the Registry.
      void setUseGlobalSslContextParameters​(boolean useGlobalSslContextParameters)
      Enable usage of global SSL context parameters.
      • Methods inherited from class org.apache.camel.support.HeaderFilterStrategyComponent

        getHeaderFilterStrategy, setEndpointHeaderFilterStrategy, setHeaderFilterStrategy
      • Methods inherited from class org.apache.camel.support.DefaultComponent

        afterConfiguration, createEndpoint, createEndpoint, doBuild, doInit, doStart, doStop, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getComponentPropertyConfigurer, getDefaultName, getEndpointPropertyConfigurer, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isAutowiredEnabled, isBridgeErrorHandler, isLazyStartProducer, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, resolveRawParameterValues, setAutowiredEnabled, setBridgeErrorHandler, setCamelContext, setLazyStartProducer, setProperties, setProperties, setProperties, useIntrospectionOnEndpoint, useRawUri, validateParameters, validateURI
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.CamelContextAware

        getCamelContext, setCamelContext
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.SSLContextParametersAware

        retrieveGlobalSslContextParameters
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • AhcComponent

        public AhcComponent()
    • Method Detail

      • createEndpoint

        protected org.apache.camel.Endpoint createEndpoint​(String uri,
                                                           String remaining,
                                                           Map<String,​Object> parameters)
                                                    throws Exception
        Specified by:
        createEndpoint in class org.apache.camel.support.DefaultComponent
        Throws:
        Exception
      • getClient

        public org.asynchttpclient.AsyncHttpClient getClient()
      • setClient

        public void setClient​(org.asynchttpclient.AsyncHttpClient client)
        To use a custom AsyncHttpClient
      • setBinding

        public void setBinding​(AhcBinding binding)
        To use a custom AhcBinding which allows to control how to bind between AHC and Camel.
      • getClientConfig

        public org.asynchttpclient.AsyncHttpClientConfig getClientConfig()
      • setClientConfig

        public void setClientConfig​(org.asynchttpclient.AsyncHttpClientConfig clientConfig)
        To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance.
      • getSslContextParameters

        public org.apache.camel.support.jsse.SSLContextParameters getSslContextParameters()
      • setSslContextParameters

        public void setSslContextParameters​(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters)
        Reference to a org.apache.camel.support.jsse.SSLContextParameters in the Registry. Note that configuring this option will override any SSL/TLS configuration options provided through the clientConfig option at the endpoint or component level.
      • isAllowJavaSerializedObject

        public boolean isAllowJavaSerializedObject()
      • setAllowJavaSerializedObject

        public void setAllowJavaSerializedObject​(boolean allowJavaSerializedObject)
        Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object

        This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.

      • isUseGlobalSslContextParameters

        public boolean isUseGlobalSslContextParameters()
        Specified by:
        isUseGlobalSslContextParameters in interface org.apache.camel.SSLContextParametersAware
      • setUseGlobalSslContextParameters

        public void setUseGlobalSslContextParameters​(boolean useGlobalSslContextParameters)
        Enable usage of global SSL context parameters.
        Specified by:
        setUseGlobalSslContextParameters in interface org.apache.camel.SSLContextParametersAware