## 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 supports only consumer endpoints. Therefore a Jetty endpoint URI should be used only as the input for an 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 can read the content of the stream just 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), use Stream Caching or convert the message body to a `String` which can be re-read multiple times.

## URI format

The URI format for a Jetty endpoint is:

    jetty:http(s)://hostname[:port][/resourceUri][?options]

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

## Options

Table 26, “Jetty options” lists the options for a Jetty endpoint.

Table 26. Jetty options

Name | Default | Description
--- | --- | ---
`sessionSupport` | `false` | Specifies 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.
`matchOnUriPrefix` | `false` | Specifies 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.
`chunked` | `true` | Specifies if the Jetty servlet uses HTTP streaming.
`enableJmx` | `false` | Specifies if Jetty JMX support will be enabled for this endpoint.
`disableStreamCache` | `false` | Specifies if the raw input stream from Jetty is cached or not.
`bridgeEndpoint` | `false` | Specifies if the HttpProducer and CamelServlet will skip the gzip processing when the content-encoding is `gzip`.
`enableMultipartFilter` | `true` | Specifies 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` | `null` | Specifies a reference to a custom multipart filter. Setting `multipartFilterRef` forces the value of `enableMultipartFilter` to `true`.
`continuationTimeout` | `30000` | Specifies a timeout, in milliseconds, when using Jetty as consumer. Zero or a negative value means the endpoint will never timeout. This option is used only when using Jetty with the asynchronous routing engine.
`useContinuation` | `true` | Specifies whether or not to use Jetty continuations for the Jetty server.
`sslContextParametersRef` | `null` | Specifies a reference to `org.apache.camel.util.jsse.SSLContextParameters` in the Registry. This reference overrides any configured SSLContextParameters at the component level.
`traceEnabled` | `false` | Specifies whether to enable HTTP TRACE for this Jetty consumer.

## Message Headers

Apache Camel uses the same message headers as the HTTP component. It also uses the `Exchange.HTTP_CHUNKED, CamelHttpChunked` header to turn on/off the chunked 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`. You can use HTTP methods to retrieve the `request.parameter` from the message header.

## Usage

The `JettyHttpComponent` supports both consumer and producer endpoints. You can also use the HTTP for producing to other HTTP endpoints.

## Component Options

The `JettyHttpComponent` provides the following options:

Name | Default | Description
--- | --- | ---
`enableJmx` | `false` | If this option is true, Jetty JMX support will be enabled for this endpoint.
`sslKeyPassword` | `null` | Consumer only: Specifies the password for the keystore when using SSL.
`sslPassword` | `null` | Consumer only: Specifies the password when using SSL.
`sslKeystore` | `null` | Consumer only: Specifies the path to the keystore.
`minThreads` |  | Consumer only: Specifies the minimum number of threads in server thread pool.
`maxThreads` |  | Consumer only: Specifies the maximum number of threads in server thread pool.
`threadPool` | `null` | Consumer only: Specifies a custom thread pool for the server.
`sslSocketConnectors` |  | Consumer only: Specifies a map containing per port number specific SSL connectors.
`socketConnectors` |  | Consumer only:Specifies a map containing per port number specific HTTP connectors.
`sslSocketConnectorProperties` | `null` | Consumer only: Specifies a map containing general SSL connector properties.
`socketConnectorProperties` | `null` | Consumer only: Specifies a map containing general HTTP connector properties.
`httpClient` |  | Producer only: Specifies a custom `HttpClient` to use with the Jetty producer.
`httpClientMinThreads` |  | Producer only: Specifies the minimum number of threads in `HttpClient` thread pool.
`httpClientMaxThreads` |  | Producer only: Specifies the maximum number of threads in `HttpClient` thread pool.
`httpClientThreadPool` |  | Producer only:Specifies a custom thread pool for the client.

## Related topics

HTTP
HTTP4
The Jetty Project