@Metadata(label="verifiers",
enums="parameters,connectivity")
public class HttpComponent
extends org.apache.camel.http.common.HttpCommonComponent
implements org.apache.camel.spi.RestProducerFactory, org.apache.camel.VerifiableComponent, org.apache.camel.SSLContextParametersAware
Modifier and Type | Field and Description |
---|---|
protected org.apache.http.conn.HttpClientConnectionManager |
clientConnectionManager |
protected int |
connectionsPerRoute |
protected long |
connectionTimeToLive |
protected org.apache.http.client.CookieStore |
cookieStore |
protected HttpClientConfigurer |
httpClientConfigurer |
protected org.apache.http.protocol.HttpContext |
httpContext |
protected int |
maxTotalConnections |
protected org.apache.camel.util.jsse.SSLContextParameters |
sslContextParameters |
protected HostnameVerifier |
x509HostnameVerifier |
Constructor and Description |
---|
HttpComponent() |
HttpComponent(Class<? extends HttpEndpoint> endpointClass) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.conn.HttpClientConnectionManager |
createConnectionManager(Map<String,Object> parameters,
org.apache.camel.util.jsse.SSLContextParameters sslContextParameters) |
protected org.apache.http.conn.HttpClientConnectionManager |
createConnectionManager(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry) |
protected org.apache.http.conn.HttpClientConnectionManager |
createConnectionManager(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry,
int maxTotalConnections,
int connectionsPerRoute) |
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> |
createConnectionRegistry(HostnameVerifier x509HostnameVerifier,
org.apache.camel.util.jsse.SSLContextParameters sslContextParams) |
protected org.apache.camel.Endpoint |
createEndpoint(String uri,
String remaining,
Map<String,Object> parameters) |
protected org.apache.http.impl.client.HttpClientBuilder |
createHttpClientBuilder(String uri,
Map<String,Object> parameters,
Map<String,Object> httpClientOptions) |
protected HttpClientConfigurer |
createHttpClientConfigurer(Map<String,Object> parameters,
boolean secure)
Creates the HttpClientConfigurer based on the given parameters
|
org.apache.camel.Producer |
createProducer(org.apache.camel.CamelContext camelContext,
String host,
String verb,
String basePath,
String uriTemplate,
String queryParameters,
String consumes,
String produces,
Map<String,Object> parameters) |
void |
doStart() |
void |
doStop() |
org.apache.http.conn.HttpClientConnectionManager |
getClientConnectionManager() |
int |
getConnectionsPerRoute() |
long |
getConnectionTimeToLive() |
org.apache.http.client.CookieStore |
getCookieStore() |
HttpClientConfigurer |
getHttpClientConfigurer() |
org.apache.http.protocol.HttpContext |
getHttpContext() |
int |
getMaxTotalConnections() |
org.apache.camel.util.jsse.SSLContextParameters |
getSslContextParameters() |
org.apache.camel.ComponentVerifier |
getVerifier() |
HostnameVerifier |
getX509HostnameVerifier() |
boolean |
isUseGlobalSslContextParameters() |
void |
setClientConnectionManager(org.apache.http.conn.HttpClientConnectionManager clientConnectionManager)
To use a custom and shared HttpClientConnectionManager to manage connections.
|
void |
setConnectionsPerRoute(int connectionsPerRoute)
The maximum number of connections per route.
|
void |
setConnectionTimeToLive(long connectionTimeToLive)
The time for connection to live, the time unit is millisecond, the default value is always keep alive.
|
void |
setCookieStore(org.apache.http.client.CookieStore cookieStore)
To use a custom org.apache.http.client.CookieStore.
|
void |
setHttpClientConfigurer(HttpClientConfigurer httpClientConfigurer)
To use the custom HttpClientConfigurer to perform configuration of the HttpClient that will be used.
|
void |
setHttpContext(org.apache.http.protocol.HttpContext httpContext)
To use a custom org.apache.http.protocol.HttpContext when executing requests.
|
void |
setMaxTotalConnections(int maxTotalConnections)
The maximum number of connections.
|
void |
setSslContextParameters(org.apache.camel.util.jsse.SSLContextParameters sslContextParameters)
To configure security using SSLContextParameters.
|
void |
setUseGlobalSslContextParameters(boolean useGlobalSslContextParameters)
Enable usage of global SSL context parameters.
|
void |
setX509HostnameVerifier(HostnameVerifier x509HostnameVerifier)
To use a custom X509HostnameVerifier such as
DefaultHostnameVerifier
or NoopHostnameVerifier . |
protected boolean |
useIntrospectionOnEndpoint() |
connect, disconnect, getHttpBinding, getHttpConfiguration, getParameter, getParameter, isAllowJavaSerializedObject, setAllowJavaSerializedObject, setHttpBinding, setHttpConfiguration
getHeaderFilterStrategy, setEndpointHeaderFilterStrategy, setHeaderFilterStrategy
createComponentConfiguration, createParameterConfigurationMap, getEndpointClass, getParameterConfigurationMap, populateParameterConfigurationMap, setEndpointClass
afterConfiguration, createConfiguration, createEndpoint, getAndRemoveOrResolveReferenceParameter, getAndRemoveOrResolveReferenceParameter, getAndRemoveParameter, getAndRemoveParameter, getCamelContext, getExtension, getSupportedExtensions, ifStartsWithReturnRemainder, isResolvePropertyPlaceholders, preProcessUri, registerExtension, registerExtension, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceListParameter, resolveAndRemoveReferenceParameter, resolveAndRemoveReferenceParameter, setCamelContext, setProperties, setProperties, setResolvePropertyPlaceholders, useRawUri, validateParameters, validateURI
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
@Metadata(label="advanced", description="To use the custom HttpClientConfigurer to perform configuration of the HttpClient that will be used.") protected HttpClientConfigurer httpClientConfigurer
@Metadata(label="advanced", description="To use a custom and shared HttpClientConnectionManager to manage connections. If this has been configured then this is always used for all endpoints created by this component.") protected org.apache.http.conn.HttpClientConnectionManager clientConnectionManager
@Metadata(label="advanced", description="To use a custom org.apache.http.protocol.HttpContext when executing requests.") protected org.apache.http.protocol.HttpContext httpContext
@Metadata(label="security", description="To configure security using SSLContextParameters. Important: Only one instance of org.apache.camel.util.jsse.SSLContextParameters is supported per HttpComponent. If you need to use 2 or more different instances, you need to define a new HttpComponent per instance you need.") protected org.apache.camel.util.jsse.SSLContextParameters sslContextParameters
@Metadata(label="security", description="To use a custom X509HostnameVerifier such as DefaultHostnameVerifier or NoopHostnameVerifier.") protected HostnameVerifier x509HostnameVerifier
@Metadata(label="producer", description="To use a custom org.apache.http.client.CookieStore. By default the org.apache.http.impl.client.BasicCookieStore is used which is an in-memory only cookie store. Notice if bridgeEndpoint=true then the cookie store is forced to be a noop cookie store as cookie shouldn\'t be stored as we are just bridging (eg acting as a proxy).") protected org.apache.http.client.CookieStore cookieStore
@Metadata(label="advanced", defaultValue="200", description="The maximum number of connections.") protected int maxTotalConnections
@Metadata(label="advanced", defaultValue="20", description="The maximum number of connections per route.") protected int connectionsPerRoute
@Metadata(label="advanced", description="The time for connection to live, the time unit is millisecond, the default value is always keep alive.") protected long connectionTimeToLive
public HttpComponent()
public HttpComponent(Class<? extends HttpEndpoint> endpointClass)
protected HttpClientConfigurer createHttpClientConfigurer(Map<String,Object> parameters, boolean secure) throws Exception
parameters
- the map of parameterssecure
- whether the endpoint is secure (eg https4)Exception
- is thrown if error creating configurerprotected org.apache.camel.Endpoint createEndpoint(String uri, String remaining, Map<String,Object> parameters) throws Exception
createEndpoint
in class org.apache.camel.impl.DefaultComponent
Exception
protected org.apache.http.conn.HttpClientConnectionManager createConnectionManager(Map<String,Object> parameters, org.apache.camel.util.jsse.SSLContextParameters sslContextParameters) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
protected org.apache.http.impl.client.HttpClientBuilder createHttpClientBuilder(String uri, Map<String,Object> parameters, Map<String,Object> httpClientOptions) throws Exception
Exception
protected org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> createConnectionRegistry(HostnameVerifier x509HostnameVerifier, org.apache.camel.util.jsse.SSLContextParameters sslContextParams) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
protected org.apache.http.conn.HttpClientConnectionManager createConnectionManager(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry)
protected org.apache.http.conn.HttpClientConnectionManager createConnectionManager(org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry, int maxTotalConnections, int connectionsPerRoute)
protected boolean useIntrospectionOnEndpoint()
useIntrospectionOnEndpoint
in class org.apache.camel.http.common.HttpCommonComponent
public org.apache.camel.Producer createProducer(org.apache.camel.CamelContext camelContext, String host, String verb, String basePath, String uriTemplate, String queryParameters, String consumes, String produces, Map<String,Object> parameters) throws Exception
createProducer
in interface org.apache.camel.spi.RestProducerFactory
Exception
public HttpClientConfigurer getHttpClientConfigurer()
public void setHttpClientConfigurer(HttpClientConfigurer httpClientConfigurer)
public org.apache.http.conn.HttpClientConnectionManager getClientConnectionManager()
public void setClientConnectionManager(org.apache.http.conn.HttpClientConnectionManager clientConnectionManager)
public org.apache.http.protocol.HttpContext getHttpContext()
public void setHttpContext(org.apache.http.protocol.HttpContext httpContext)
public org.apache.camel.util.jsse.SSLContextParameters getSslContextParameters()
public void setSslContextParameters(org.apache.camel.util.jsse.SSLContextParameters sslContextParameters)
public boolean isUseGlobalSslContextParameters()
isUseGlobalSslContextParameters
in interface org.apache.camel.SSLContextParametersAware
public void setUseGlobalSslContextParameters(boolean useGlobalSslContextParameters)
setUseGlobalSslContextParameters
in interface org.apache.camel.SSLContextParametersAware
public HostnameVerifier getX509HostnameVerifier()
public void setX509HostnameVerifier(HostnameVerifier x509HostnameVerifier)
DefaultHostnameVerifier
or NoopHostnameVerifier
.public int getMaxTotalConnections()
public void setMaxTotalConnections(int maxTotalConnections)
public int getConnectionsPerRoute()
public void setConnectionsPerRoute(int connectionsPerRoute)
public long getConnectionTimeToLive()
public void setConnectionTimeToLive(long connectionTimeToLive)
public org.apache.http.client.CookieStore getCookieStore()
public void setCookieStore(org.apache.http.client.CookieStore cookieStore)
public void doStart() throws Exception
doStart
in class org.apache.camel.impl.DefaultComponent
Exception
public void doStop() throws Exception
doStop
in class org.apache.camel.impl.DefaultComponent
Exception
public org.apache.camel.ComponentVerifier getVerifier()
getVerifier
in interface org.apache.camel.VerifiableComponent
Apache Camel