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

NameDefaultDescription
headerFilterStrategyAn instance of RestletHeaderFilterStrategyUse 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.
restletBindingAn instance of DefaultRestletBindingUse the # notation (restletBinding=#refName) to specify the bean ID of a RestletBinding object in the Camel registry.
restletMethodGETOn 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.
restletRealmnullUse the # notation (restletRealm=#refName) to specify the bean ID of the Realm Map in the Camel registry.
restletUriPatternsNoneConsumer 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.
throwExceptionOnFailuretrueProducer 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 ) :

NameDefaultDescription
controllerDaemontrueIndicates whether the controller thread should be a daemon (not blocking JVM exit).
controllerSleepTimeMs100Specifies the time, in milliseconds, for the controller thread to sleep between each control.
inboundBufferSize8192Specifies the size of the buffer when reading messages.
minThreads1Specifies the minimum number of threads that will wait to service requests.
maxThreads10Specifies the maximum number of threads that will service requests.
maxConnectionsPerHost-1Specifies the maximum number of concurrent connections per host (IP address).
maxTotalConnections-1Specifies the maximum number of concurrent connections in total.
outboundBufferSize8192Specifies the size of the buffer when writing messages.
persistingConnectionstrueIndicates the whether connections should be kept alive after a call.
pipeliningConnectionsfalseIndicates the whether pipelining connections are supported.
threadMaxIdleTimeMs60000Specifies the time, in milliseconds, for an idle thread to wait for an operation before being collected.
useForwardedForHeaderfalseLooks 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:

NameTypeDescription
Content-TypeStringSpecifies 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.
CamelAcceptContentTypeStringSpecifies the HTTP Accept request header.
CamelHttpMethodStringApache Camel 2.9.3: Specifies the HTTP request method. This is set in the IN message header.
CamelHttpQueryStringSpecifies the query string of the request URI. It is set on the IN message the endpoint receives a request.
CamelHttpResponseCodeString or IntegerSpecifies 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.
CamelHttpUriStringSpecifies the HTTP request URI. This is set in the IN message header.
CamelRestletLoginStringSpecifies the login name for basic authentication. It is set on the IN message by the application and gets filtered before the restlet request header.
CamelRestletPasswordStringSpecifies the password for basic authentication. It is set on the IN message by the application and gets filtered before the restlet request header.
CamelRestletRequestRequestApache Camel 2.8: Specifies the org.restlet.Request object that holds all request details.
CamelRestletResponseResponseApache 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