Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Java DSL

Spring DSL

Code Block
from("direct:start")
  .setHeader(Exchange.HTTP_METHOD, constant("POST"))
  .to("http://www.google.com");
Code Block
xml
xml
<from uri="direct:start"/>
<setHeader headerName="CamelHttpMethod">
  <constant>POST</constant>
</setHeader>
<to uri="http://www.google.com"/>
<to uri="mock:results"/>

HttpEndpoint Options

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} || Name || Default Value || Description || | {{throwExceptionOnFailure}} | {{true}} | Option to disable throwing the {{HttpOperationFailedException}} in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | | {{bridgeEndpoint}} | {{false}} | 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 * throwExceptionOnFailure* to be false to let the HttpProducer send all the fault response back. \\ *Camel 2.3:* If the option is true, HttpProducer and CamelServlet will skip the gzip processing if the content-encoding is "gzip". | | {{disableStreamCache}} | {{false}} | DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support read it twice, otherwise DefaultHttpBinding will set the request input stream direct into the message body. | | {{httpBindingRef}} | {{null}} | *Deprecated and will be removed in Camel 3.0:* Reference to a {{

Name

Default Value

Description

throwExceptionOnFailure

true

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

bridgeEndpoint

false

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 * throwExceptionOnFailure* to be false to let the HttpProducer send all the fault response back.
Camel 2.3: If the option is true, HttpProducer and CamelServlet will skip the gzip processing if the content-encoding is "gzip".

disableStreamCache

false

DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support read it twice, otherwise DefaultHttpBinding will set the request input stream direct into the message body.

httpBindingRef

null

Deprecated and will be removed in Camel 3.0: Reference to a

org.apache.camel.component.http.HttpBinding

}}

in

the

[]

.

Use

the

{{

httpBinding

}}

option

instead.

| | {{httpBinding}} | {{null}} | *Camel

httpBinding

null

Camel 2.3:

*

Reference

to

a

{{

org.apache.camel.component.http.HttpBinding

}}

in

the

[]. | | {{httpClientConfigurerRef}} | {{null}} | *Deprecated and will be removed in Camel

.

httpClientConfigurerRef

null

Deprecated and will be removed in Camel 3.0:

*

Reference

to

a

{{

org.apache.camel.component.http.HttpClientConfigurer

}}

in

the

[]

.

Use

the

{{

httpClientConfigurer

}}

option

instead.

| | {{httpClientConfigurer}} | {{null}} | *Camel

httpClientConfigurer

null

Camel 2.3:

*

Reference

to

a

{{

org.apache.camel.component.http.HttpClientConfigurer

}}

in

the

[]. | | {{

.

httpClient.XXX

}} | {{null}} | Setting options on the [HttpClientParams|http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpClientParams.html]. For instance {{

null

Setting options on the HttpClientParams. For instance httpClient.soTimeout=5000

}}

will

set

the

{{

SO_TIMEOUT

}}

to

5

seconds.

| | {{clientConnectionManager}} | {{null}} | To use a custom {{

clientConnectionManager

null

To use a custom org.apache.http.conn.ClientConnectionManager

}}. | | {{transferException}} | {{false}} | *Camel

.

transferException

false

Camel 2.6:

*

If

enabled

and

an

[]

failed

processing

on

the

consumer

side,

and

if

the

caused {{Exception}} was send back serialized in the response as a {{

caused Exception was send back serialized in the response as a application/x-java-serialized-object

}}

content

type

(for

example

using

[]

or

[]

Camel

components).

On

the

producer

side

the

exception

will

be

deserialized

and

thrown

as

is,

instead

of

the

{{

HttpOperationFailedException

}}

.

The

caused

exception

is

required

to

be

serialized.

| | {{headerFilterStrategy}} | {{null}} | *Camel

headerFilterStrategy

null

Camel 2.11:

*

Reference

to

a

instance

of

{{

org.apache.camel.spi.HeaderFilterStrategy

}}

in

the

[]

.

It

will

be

used

to

apply

the

custom

headerFilterStrategy

on

the

new

create

HttpEndpoint.

| | {{urlRewrite}} | {{null}} | *Camel

urlRewrite

null

Camel 2.11:

* *Producer only* Refers to a custom {{

Producer only Refers to a custom org.apache.camel.component.http.UrlRewrite

}}

which

allows

you

to

rewrite

urls

when

you

bridge/proxy

endpoints.

See

more

details

at

[]

and

[ ]

.

| {div}

Authentication and Proxy

The following authentication options can also be set on the HttpEndpoint:

Div
classconfluenceTableSmall

Name

Default Value

Description

authMethod

null

Authentication method, either as Basic, Digest or NTLM.

authMethodPriority

null

Priority of authentication methods. Is a list separated with comma. For example: Basic,Digest to exclude NTLM.

authUsername

null

Username for authentication

authPassword

null

Password for authentication

authDomain

null

Domain for NTML authentication

authHost

null

Optional host for NTML authentication

proxyHost

null

The proxy host name

proxyPort

null

The proxy port number

proxyAuthMethod

null

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

proxyAuthUsername

null

Username for proxy authentication

proxyAuthPassword

null

Password for proxy authentication

proxyAuthDomain

null

Domain for proxy NTML authentication

proxyAuthHost

null

Optional host for proxy NTML authentication

Wiki Markup
{div:class=confluenceTableSmall} || Name || Default Value || Description || | {{authMethod}} | {{null}} | Authentication method, either as {{Basic}}, {{Digest}} or {{NTLM}}. | | {{authMethodPriority}} | {{null}} | Priority of authentication methods. Is a list separated with comma. For example: {{Basic,Digest}} to exclude {{NTLM}}. | | {{authUsername}} | {{null}} | Username for authentication | | {{authPassword}} | {{null}} | Password for authentication | | {{authDomain}} | {{null}} | Domain for NTML authentication | | {{authHost}} | {{null}} | Optional host for NTML authentication | | {{proxyHost}} | {{null}} | The proxy host name | | {{proxyPort}} | {{null}} | The proxy port number | | {{proxyAuthMethod}} | {{null}} | Authentication method for proxy, either as {{Basic}}, {{Digest}} or {{NTLM}}. | | {{proxyAuthUsername}} | {{null}} | Username for proxy authentication | | {{proxyAuthPassword}} | {{null}} | Password for proxy authentication | | {{proxyAuthDomain}} | {{null}} | Domain for proxy NTML authentication | | {{proxyAuthHost}} | {{null}} | Optional host for proxy NTML authentication | {div}

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.

The HTTP component uses convention over configuration which means that if you have not explicit set a authMethodPriority then it will fallback and use the select(ed) authMethod as priority as well. So if you use authMethod.Basic then the auhtMethodPriority will be Basic only.

HttpComponent Options

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} || Name || Default Value || Description || | {{httpBinding}} | {{null}} | To use a custom {{

Name

Default Value

Description

httpBinding

null

To use a custom

org.apache.camel.component.http.HttpBinding

}}. | | {{httpClientConfigurer}} | {{null}} | To use a custom {{

.

httpClientConfigurer

null

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

}}. | | {{httpConnectionManager}} | {{null}} | To use a custom {{

.

httpConnectionManager

null

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

}}. | | {{httpConfiguration}} | {{null}} | To use a custom {{

.

httpConfiguration

null

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

}} | {div}

HttpConfiguration contains all the options listed in the table above under the section HttpConfiguration - Setting Authentication and Proxy.

Message Headers

Div
classconfluenceTableSmall
Wiki Markup
{div:class=confluenceTableSmall} || Name || Type || Description || | {{

Name

Type

Description

Exchange.HTTP_URI

}} | {{String}} | URI to call. Will override existing URI set directly on the endpoint. | | {{

String

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

Exchange.HTTP_METHOD

}} | {{String}} | HTTP Method / Verb to use

String

HTTP Method / Verb to use (GET/POST/PUT/DELETE/HEAD/OPTIONS/TRACE)

| | {{

Exchange.HTTP_PATH

}} | {{String}} | Request

String

Request URI's

path,

the

header

will

be

used

to

build

the

request

URI

with

the

HTTP_URI.

*

Camel

2.3.0:

*

If

the

path

is

start

with

"/",

http

producer

will

try

to

find

the

relative

path

based

on

the

Exchange.HTTP_BASE_URI

header

or

the

exchange.getFromEndpoint().getEndpointUri();

| | {{

Exchange.HTTP

_QUERY}} | {{String}} | URI parameters. Will override existing URI parameters set directly on the endpoint. | | {{

_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. | | {{

int

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

Exchange.HTTP_CHARACTER_ENCODING

}} | {{String}} | 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}}. | | {{

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}}. | | {{

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}} | The {{HttpServletRequest}} object. | | {{

HttpServletRequest

The HttpServletRequest object.

Exchange.HTTP_SERVLET_RESPONSE

}} | {{HttpServletResponse}} | The {{HttpServletResponse}} object. | | {{

HttpServletResponse

The HttpServletResponse object.

Exchange.HTTP_PROTOCOL_VERSION

}} | {{String}} | *Camel

String

Camel 2.5:

*

You

can

set

the

http

protocol

version

with

this

header,

eg.

"HTTP/1.0".

If

you

didn't

specify

the

header,

HttpProducer

will

use

the

default

value

"HTTP/1.1"

| {div}

The header name above are constants. For the spring DSL you have to use the value of the constant instead of the name.

...