...
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 org.apache.camel.component.http.HttpBinding in the Registry. Use the httpBinding option instead. | httpBinding
| null
| Camel 2.3: Reference to a org.apache.camel.component.http.HttpBinding in the Registry. | httpClientConfigurerRef
| null
| Deprecated and will be removed in Camel 3.0: Reference to a org.apache.camel.component.http.HttpClientConfigurer in the Registry. Use the httpClientConfigurer option instead. | httpClientConfigurer
| null
| Camel 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
| To use a custom org.apache.http.conn.ClientConnectionManager . | transferException
| false
| Camel 2.6: If enabled and an Exchange failed processing on the consumer side, and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type (for example using Jetty or SERVLET 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 2.11: Reference to a instance of org.apache.camel.spi.HeaderFilterStrategy in the Registry. It will be used to apply the custom headerFilterStrategy on the new create HttpEndpoint. | urlRewrite
| null
| Camel 2.11: 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 UrlRewrite and How to use Camel as a HTTP proxy between a client and server. | eagerCheckContentAvailable | false | Camel 2.15.3: Consumer only Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present. This can be turned on in case HTTP clients do not send streamed data. |
|
Authentication and Proxy
The following authentication options can also be set on the HttpEndpoint:
...
In the route below we want to route a message that we enrich with data returned from a remote HTTP call. As we want any response from the remote server, we set the throwExceptionOnFailure
option to false
so we get any response in the AggregationStrategy
. As the code is based on a unit test that simulates a HTTP status code 404, there is some assertion code etc.
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java} |
Disabling Cookies
To disable cookies you can set the HTTP Client to ignore cookies by adding this URI option:
httpClient.cookiePolicy=ignoreCookies
...
First, we define the http
component in Spring XML. Yes, we use the same scheme name, http
, because otherwise Camel will auto-discover and create the component with default settings. What we need is to overrule this so we can set our options. In the sample below we set the max connection to 5 instead of the default of 2.
Wiki Markup |
---|
{snippet:id=e1|lang=xml|url=camel/tags/camel-2.2.0/tests/camel-itest/src/test/resources/org/apache/camel/itest/http/HttpMaxConnectionPerHostTest-context.xml} |
And then we can just use it as we normally do in our routes:
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} |
Using preemptive authentication
...