Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can append query options to the URI in the following format, ?option=value&option=value&...

Info
titleAbout HTTP Client version

Notice Camel 2.2 or older uses the Apache HTTP Client 3.1. We upgraded to HTTP Client 4.0.1 in Camel 2.3. This has an impact if you need advanced configuration as these two versions is much different how you do that. Consult the HTTP Client 4.x documentation.

Info
titlecamel-http vs camel-jetty

You can only produce to endpoints generated by the HTTP component. Therefore it should never be used as input into your camel Routes. To bind/expose an HTTP endpoint via a HTTP server as input to a camel route, you can use the Jetty Component

HttpEndpoint Options

camel-http vs camel-jetty

You can only produce to endpoints generated by the HTTP component. Therefore it should never be used as input into your camel Routes. To bind/expose an HTTP endpoint via a HTTP server as input to a camel route, you can use the Jetty Component

HttpEndpoint Options

Name

Default Value

Description

throwExceptionOnFailure

true

Camel

Name

Default Value

Description

throwExceptionOnFailure

true

Camel 2.0: Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardles of the HTTP status code.

bridgeEndpoint

false

Camel 2.1: If the option is true , HttpProducer will ignore the Exchange.HTTP_URI header, and use the endpoint's URI for request. You may also set the throwExcpetionOnFailure to be false to let the HttpProducer send all the fault response back.

httpBindingRef

null

@deprecated: Reference to a org.apache.camel.component.http.HttpBinding in the Registry.

username httpBinding

null

Username for Basic HTTP/NTML Authentication.

password

null

Password for Basic HTTP/NTML Authentication.

Camel 2.3: Reference to a org.apache.camel.component.http.HttpBinding in the Registry.

httpClientConfigurerRef

null

@deprecated: Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry.

httpClientConfigurer domain

null

Camel 2.1: Domain for NTML Authentication. This option must be used to force NTML authentication.

proxyHost

null

The proxy host name * only for >= Camel 1.6.2 *.

proxyPort

null

The proxy port number * only for >= Camel 1.6.2 *.

3: Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry.

httpClient.XXX

null

Setting options on the HttpClientParams. For instance httpClient.soTimeout=5000 will set the SO_TIMEOUT to 5 seconds.

clientConnectionManager

null

Camel 2.3: To use a custom org.apache.http.conn.ClientConnectionManager.

Camel 2.2 or older: Setting Authentication and Proxy

Name

Default Value

Description

username proxyUsername

null

Username for proxy authentication * only for >= Camel 1. 6.2 *.

proxyPassword password

null

Password for proxy authentication * only for >= Camel 1.6. 2 *.

httpClientConfigurerRef domain

null

Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry.

httpClient.XXX

null

Camel 2.2 or older: Setting options on the HttpClientParams. For instance httpClient.soTimeout=5000 will set the SO_TIMEOUT to 5 seconds.

Camel 2.1: Domain for NTML Authentication. This option must be used to force NTML authentication.

proxyHost

null

Camel 1.6.2: The proxy host name

proxyPort

null

Camel 1.6.2: The proxy port number

proxyUsername

null

Camel 1.6.2: Username for proxy authentication

proxyPassword

null

Camel 1.6.2: Password for proxy authentication

httpClient.XXX

null

Camel 2.3 or newer: Setting

...

Authentication and Proxy

Name

Default Value

Description

proxyHost

null

The proxy host name

proxyPort

null

The proxy port number

authMethod

null

Authentication method, either as Basic, Digest or NTML.

authUsername

null

Username for authentication

authPassword

null

Password for authentication

authDomain

null

Domain for NTML authentication

authHost

null

Optional host for NTML authentication

proxyAuthMethod

null

Authentication method for proxy, either as Basic, Digest or NTML.

proxyAuthUsername

null

Username for proxy authentication

proxyAuthPassword

null

Password for proxy authentication

When using authentication you must provide the choice of method for the authMethod or authProxyMethod options.
You can configure the proxy and authentication details on either the HttpComponent or the HttpEndoint. Values provided on the HttpEndpoint will take precedence over HttpComponent. Its most likely best to configure this on the HttpComponent which allows you to do this once.

HttpComponent Options

Name

Default Value

Description

httpBinding

null

To use a custom org.apache.camel.component.http.HttpBinding.

httpClientConfigurer

null

To use a custom org.apache.camel.component.http.HttpClientConfigurer.

httpConnectionManager

null

To use a custom org.apache.commons.httpclient.HttpConnectionManager.

httpConfiguration

null

Camel 2.3: To use a custom org.apache.camel.component.http.HttpConfiguration

Notice that in Camel 2.3 the options on org.apache.camel.component.http.HttpConfiguration is all provided as delegates on HttpComponent so you easily can configure proxy and authentication details

...

clientConnectionManager

...

null

...

Camel 2.3: To use a custom org.apache.http.conn.ClientConnectionManager.

HttpComponent Options

Name

Default Value

Description

maxTotalConnections

200

Camel 2.3: Defines the maximum number of connections in total.

connectionsPerRoute

20

Camel 2.3: Defines the maximum number of connections per route.

clientConnectionManager

null

Camel 2.3: To use a custom org.apache.http.conn.ClientConnectionManager.

httpBinding

null

To use a custom org.apache.camel.component.http.HttpBinding.

httpClientConfigurer

null

To use a custom org.apache.camel.component.http.HttpClientConfigurer.

Camel 2.3 or newer

In Camel 2.3 we upgraded to use Apache HTTP Client 4.0.1 which is a major upgrade over the older Client 3.1 release. A significant change is that the HTTPClient is using a shared HttpClientConnectionManager as one giant thread pool. By default its configured to allow 200 concurrent threads. That means you cannot use different options for the HttpClientConnectionManager. If you for some odd reason want that you can define a 2nd CamelHttpComponent and let it use a different configured HttpClientConnectionManager.

Message Headers

Camel 1.x

...

Setting MaxConnectionsPerHost

...

The Http Component has a org.apache.commons.httpclient.HttpConnectionManager where you can configure various global configuration for the given component.
By global, we mean that any endpoint the component creates has the same shared HttpConnectionManager. So, if we want to set a different value for the max connection per host, we need to define it on the HTTP component and not on the endpoint URI that we usually use. So here comes:

...

Wiki Markup
{snippet:id=e2|lang=xml|url=camel/tags/camel-2.2.0/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml}

Camel 2.3 or newer
We can se the MaxConnectionsPerHost option, which is named connectionsPerRoute in HTTP Client 4.x directly on the Camel HttpComponent, which can be done as follows:

Code Block
xmlxml

<bean id="http" class="org.apache.camel.component.http.HttpComponent">
    <property name="connectionsPerRoute" value="5"/>
</bean>
tags/camel-2.2.0/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml}

Using HTTPS to authenticate gotchas

...