## Name

Restlet — provides Restlet-based endpoints for consuming and producing RESTful resources

## URI format

The URI format for a Restlet endpoint is:

    restlet:http://hostname[:port][/resourcePattern][?options]

The default port is port 80.

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

## Endpoint options

Table 27, “Restlet endpoint options” lists the options for a Servlet endpoint.

Table 27. Restlet endpoint options

Name | Default | Description
--- | --- | ---
`headerFilterStrategy` | An instance of `RestletHeaderFilterStrategy` | Use the # notation (`headerFilterStrategy=#``refName`) to reference a header filter strategy in the Camel Registry. The strategy will be plugged into the restlet binding if it is `HeaderFilterStrategyAware`.
`restletBinding` | An instance of `DefaultRestletBinding` | Use the # notation (`restletBinding=#``refName`) to specify the bean ID of a `RestletBinding` object in the Camel registry.
`restletMethod` | `GET` | On a producer endpoint, specifies the request method to use. On a consumer endpoint, specifies that the endpoint consumes only `restletMethod` requests.
`restletMethods` |  | Consumer only: Specifies one or more methods separated by commas to be serviced by a restlet consumer endpoint. `restletMethods` takes president over `restletMethod`.
`restletRealm` | `null` | Use the # notation (`restletRealm=#``refName`) to specify the bean ID of the Realm Map in the Camel registry.
`restletUriPatterns` | None | Consumer only: Specifies one ore more URI templates to be serviced by a restlet consumer endpoint using the `#` notation to reference a `List<String>` in the registry. If a URI pattern has been defined in the endpoint URI, both the URI pattern defined in the endpoint and the `restletUriPatterns` option will be honored.
`throwExceptionOnFailure` | `true` | Producer only: Throws an exception on a producer failure.

## Component options

The Restlet component can be configured using the following options (available as Apache Camel 2.10 ) :

Name | Default | Description
--- | --- | ---
`controllerDaemon` | `true` | Indicates whether the controller thread should be a daemon (not blocking JVM exit).
`controllerSleepTimeMs` | `100` | Specifies the time, in milliseconds, for the controller thread to sleep between each control.
`inboundBufferSize` | `8192` | Specifies the size of the buffer when reading messages.
`minThreads` | `1` | Specifies the minimum number of threads that will wait to service requests.
`maxThreads` | `10` | Specifies the maximum number of threads that will service requests.
`maxConnectionsPerHost` | `-1` | Specifies the maximum number of concurrent connections per host (IP address).
`maxTotalConnections` | `-1` | Specifies the maximum number of concurrent connections in total.
`outboundBufferSize` | `8192` | Specifies the size of the buffer when writing messages.
`persistingConnections` | `true` | Indicates the whether connections should be kept alive after a call.
`pipeliningConnections` | `false` | Indicates the whether pipelining connections are supported.
`threadMaxIdleTimeMs` | `60000` | Specifies the time, in milliseconds, for an idle thread to wait for an operation before being collected.
`useForwardedForHeader` | `false` | Looks up the X-Forwarded-For header, supported by popular proxies and caches, and uses it to populate the result of the `Request.getClientAddresses` method. This information is safe only for intermediary components within the local network. Other addresses could easily be changed by setting a fake header, so should not be trusted for serious security checks.

## Message headers

Restlet endpoints use the following message headers:

Name | Type | Description
--- | --- | ---
`Content-Type` | `String` | Specifies the content type of the response message. If this header is not set, the content type is based on the object type of the OUT message body. If the content type is specified in the IN message, that value determines the content type for the Restlet request message. Otherwise, the content type is defaulted to `application/x-www-form-urlencoded`.
`CamelAcceptContentType` | `String` | Specifies the HTTP Accept request header.
`CamelHttpMethod` | `String` | Apache Camel 2.9.3: Specifies the HTTP request method. This is set in the IN message header.
`CamelHttpQuery` | `String` | Specifies the query string of the request URI. It is set on the IN message the endpoint receives a request.
`CamelHttpResponseCode` | `String` or `Integer` | Specifies the response code to set on the OUT message by the application/processor. The value is the response code of the response message. If this header is not set, the response code is set by the restlet runtime engine.
`CamelHttpUri` | `String` | Specifies the HTTP request URI. This is set in the IN message header.
`CamelRestletLogin` | `String` | Specifies the login name for basic authentication. It is set on the IN message by the application and gets filtered before the restlet request header.
`CamelRestletPassword` | `String` | Specifies the password for basic authentication. It is set on the IN message by the application and gets filtered before the restlet request header.
`CamelRestletRequest` | `Request` | Apache Camel 2.8: Specifies the `org.restlet.Request` object that holds all request details.
`CamelRestletResponse` | `Response` | Apache Camel 2.8: Specifies the `org.restlet.Response` object. You can use this option to create responses using the Restlet API.
`org.restlet.*` |  | Specifies the attributes of a Restlet message that get propagated to Apache Camel IN headers.

## Message Body

Apache Camel stores the restlet response from the external server in the OUT body. All headers from the IN message are copied to the OUT message, so that headers are preserved during routing.

## Related topics

The Restlet Project