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.
URI format
The URI format for a Jetty endpoint is:
jetty:http(s)://hostname
[:port
][/resourceUri
][?options
]
Options
Table 5.6 lists the options for a Jetty endpoint.
Table 5.6. Jetty options
Name | Default | Description |
---|---|---|
sessionSupport | false | Specifies whether to enable the session manager on the server side of Jetty. |
httpClient. | 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 |
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 | 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 only used when using Jetty with the asynchronous routing engine. |
useContinuation | true | Specifies 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
.
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. |