LibraryToggle FramesPrintFeedback

Name

Jetty — provides endpoints for consuming HTTP requests

Overview

The Jetty component provides HTTP-based endpoints for consuming HTTP requests. That is, the Jetty component behaves as a simple Web server.

The Jetty component only supports consumer endpoints. Therefore a Jetty endpoint URI should be used only as the input for a Apache Camel route. To issue HTTP requests against other HTTP endpoints, use the HTTP Component.

Jetty is stream based, which means the input it receives is submitted to Camel as a stream. That means you will only be able to read the content of the stream once. If you find a situation where the message body appears to be empty or you need to access the data multiple times (eg: doing multicasting, or redelivery error handling) you should use Stream Caching or convert the message body to a String which is safe to be re-read multiple times.

Options

Table 5.6 lists the options for a Jetty endpoint.

Table 5.6. Jetty options

NameDefaultDescription
sessionSupportfalseSpecifies whether to enable the session manager on the server side of Jetty.
httpClient.XXX Specifies options to set on Jetty's HttpClient. For example, setting httpClient.idleTimeout=30000 sets the idle timeout to 30 seconds.
httpBindingRef Specifies a reference to an org.apache.camel.component.http.HttpBinding in the registry.
jettyHttpBindingRef Specifies a reference to an org.apache.camel.component.jetty.JettyHttpBinding in the registry.
matchOnUriPrefixfalseSpecifies whether or not the CamelServlet should try to find a target consumer by matching the URI prefix if no exact match is found.
handlers Specifies a comma-delimited set of org.mortbay.jetty.Handler instances in the registry that are added to the Jetty servlet context.
chunkedtrueSpecifies if the Jetty servlet uses HTTP streaming.
enableJmxfalseSpecifies if Jetty JMX support will be enabled for this endpoint.
disableStreamCachefalseSpecifies if the raw input stream from Jetty is cached or not.
bridgeEndpointfalse

Specifies if the HttpProducer and CamelServlet will skip the gzip processing when the content-encoding is gzip.

enableMultipartFiltertrueSpecifies if Jetty org.eclipse.jetty.servlets.MultiPartFilter is enabled. You should set this value to false when bridging endpoints, to ensure multipart requests are proxied/bridged as well.
multipartFilterRef Specifies a reference to a custom multipart filter. Setting multipartFilterRef forces the value of enableMultipartFilter to true.
continuationTimeout30000Specifies a timeout, in milliseconds, when using Jetty as consumer. Zero or a negative value means the endpoint will never timeout. This option is only used when using Jetty with the asynchronous routing engine.
useContinuationtrueSpecifies whether or not to use Jetty continuations for the Jetty server.

Message Headers

Apache Camel uses the same message headers as the HTTP component. It also uses the Exchange.HTTP_CHUNKED header to turn on or turn off the chuncked encoding on the consumer.

Apache Camel also populates all request.parameter and request.headers. For example, given a client request with the URL http://myserver/myserver?orderid=123, the exchange will contain a header named orderid with the value 123.

Comments powered by Disqus