Versions Compared

Key

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

...

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

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

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

username

null

Username for Basic HTTP/NTML Authentication.

password

null

Password for Basic HTTP/NTML Authentication.

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 *.

proxyUsername

null

Username for proxy authentication * only for >= Camel 1.6.2 *.

proxyPassword

null

Password for proxy authentication * only for >= Camel 1.6.2 *.

httpClientConfigurerRef

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.

httpClient.XXX

null

Camel 2.3: Setting options on HttpParam on both HttpClient and HttpClientConnectionManager. For instance httpClient.soTimeout=5000 will set the SO_TIMEOUT to 5 seconds. Notice that the HttpClientConnectionManager is shared among all producers and consumers created by the same HttpComponent.

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.

Camel 2.3 or newer

...

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

Name

Type

Description

HttpProducer.HTTP_URI

String

Camel 1.6.0: URI to call. Will override existing URI

Message Headers

Camel 1.x

Name

Type

Description

HttpProducer.HTTP_URI

String

Camel 1.5.1: URI to call. Will override existing URI set directly on the endpoint. Is set on the In message.

HttpProducer.HTTP_RESPONSE_CODE

int

The HTTP response code from the external server. Is 200 for OK. Is set on the Out message.

HttpProducer.QUERY

String

URI parameters. Will override existing URI parameters set directly on the endpoint. Is set on the In message.

Camel 2.0

HttpProducer.HTTP_RESPONSE_CODE

int

The HTTP response code from the external server. Is 200 for OK. Is set on the Out message.

HttpProducer.QUERY

Name

Type

Description

Exchange.HTTP_URI

String

URI to callparameters. Will override existing URI parameters set directly on the endpoint. Is set on the In message.

Camel 2.x

Name

Type

Description

Exchange.HTTP_URI

String

URI to call. Will override existing URI set directly on the endpoint.

Exchange.HTTP_Exchange.HTTP_PATH

String

Request URI's path.

Exchange.HTTP_QUERY

String

URI parameters. Will override existing URI parameters set directly on the endpoint.

Exchange.HTTP_RESPONSE_CODE

int

The HTTP response code from the external server. Is 200 for OK.

Exchange.HTTP_CHARACTER_ENCODING

String

Character encoding.

Exchange.CONTENT_TYPE

String

The HTTP content type. Is set on both the IN and OUT message to provide a content type, such as text/html.

Exchange.CONTENT_ENCODING

String

The HTTP content encoding. Is set on both the IN and OUT message to provide a content encoding, such as gzip.

Exchange.HTTP_SERVLET_REQUEST

HttpServletRequest

From Camel 2.3.0, you can get the : The HttpServletRequest object from the message header, .

Exchange.HTTP_SERVLET_RESPONSE

HttpServletResponse

From Camel 2.3.0, you can get the : The HttpServletResponse object from the message header.

Message Body

Camel will store the HTTP response from the external server on the OUT body. All headers from the IN message will be copied to the OUT message, so headers are preserved during routing. Additionally Camel will add the HTTP response headers as well to the OUT message headers.

...

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
Consult the Apache We can se the MaxConnectionsPerHost option, which is named connectionsPerRoute in HTTP Client 4.x documentation as HTTP Client 4.0 is configured much differently than the older 3.1.directly on the Camel HttpComponent, which can be done as follows:

Code Block
xml
xml

<bean id="http" class="org.apache.camel.component.http.HttpComponent">
    <property name="connectionsPerRoute" value="5"/>
</bean>

Using HTTPS to authenticate gotchas

...