...
Name | Default Value | Description | |||
---|---|---|---|---|---|
headerFilterStrategy=#refName (2.x or later) | An instance of RestletHeaderFilterStrategy object | 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. | |||
restletBindingRef (1.x). For 2.x or later, use restletBinding=#refName | An instance of DefaultRestletBinding object | The name to lookup the RestletBinding object in the Camel Registry. | |||
restletMethod | GET | The method to be used in the request for producer. For consumer, the Restlet Endpoint only consumes requests made by restletMethod. The string value is converted to org.restlet.data.Method by the Method.valueOf(String) method. | |||
In 1.x only, restletBindingRef. For restletMethods (2.x or later, use restletBinding=#refName ) | none | This option is only valid for consumer. Specify one or more methods separated by commas (e.g. restletMethods=post,put) to be serviced by a Restlet endpoint. If both "restletMethod" and "restletMethods" options are specified, the value of restletMethod is ignored. | |||
restletRealmRef (1.x) | An instance of DefaultRestletBinding object | The name to lookup the RestletBinding object in the Camel Registry. | In 1.x only, restletRealmRef. For 2.x or later use restletRealm=#refName | null | The name to lookup the Realm Map in the Camel Registry. |
headerFilterStrategy uriPatterns=#refName (2.x or later) | An instance of RestletHeaderFilterStrategy object | none | This option is only valid for consumer. Specify one ore more uri templates to be serviced by a Restlet endpoint using the # notation to reference a List (of String) in Camel Registry. 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. |
Message Headers
Camel 1.x
Name | Type | Description |
---|---|---|
org.apache.camel.restlet.auth.login | String | Login name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. |
org.apache.camel.restlet.auth.password | String | Password name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. |
org.apache.camel.restlet.mediaType | String | It can be set on the OUT message by application/processor. The value is the content-type of the response message. If this header is not set, content-type will be set based on the object type of the out message body. |
org.apache.camel.restlet.queryString | String | The query string of the request URI. It is set on the IN message by DefaultRestletBinding when the Restlet Component receives a request. |
org.apache.camel.restlet.responseCode | String or Integer | It can be set on the OUT message by application/processor. The value is the response code of the response message. If this header is not set, response code will be set by Restlet runtime engine. |
org.restlet.* |
| Attributes of a Restlet message that get propagated to Camel IN headers. |
Camel 2.0
Name | Type | Description | |
---|---|---|---|
CamelRestletLogin | String | Login name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. | |
CamelRestletPassword | String | Password name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. | |
CamelContentType | CamelRestletMediaType | String | It can be set on the OUT message by application/processor. The value is the content-type of the response message. If this header is not set, content-type will be set based on the object type of the out message body. |
CamelHttpMethod | String | The HTTP request method. This is et in the IN message header. | |
CamelHttpQuery CamelRestletQueryString | String | The query string of the request URI. It is set on the IN message by DefaultRestletBinding when the Restlet Component receives a request. | |
CamelRestletRsponseCode CamelHttpRsponseCode | String or Integer | It can be set on the OUT message by application/processor. The value is the response code of the response message. If this header is not set, response code will be set by Restlet runtime engine. | |
CamelHttpUri | String | The HTTP request URI. This is set in the IN message header. | |
CamelRestletLogin | String | Login name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. | |
CamelRestletPassword | String | Password name for basic authentication. It is set on the IN message by application and get filtered before Restlet Request header by Camel. |
org.restlet.* |
| Attributes of a Restlet message that get propagated to Camel IN headers. |
...
This sample starts a Restlet consumer endpoint that listens POST requests on http://localhost:8080. The route looks like follow. The consumer invokes a processor that creates a response to echo the request body and the value of header "id".
...
The sample starts a direct endpoint that sends requests to the server on http://localhost:8080 (i.e. our Restlet consumer endpoint).
...
Code Block |
---|
received [<order foo='1'/>] as an order id = 89531 |
Single Restlet endpoint to service multiple methods and URI templates (2.0 or later)
It is possible to create a single route to service multiple HTTP methods using the restletMethods option. This snippet also shows how to retrieve the request method from the header.
Wiki Markup |
---|
{snippet:id=routeDefinition|lang=java|url=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiMethodsEndpointTest.java} |
In addition to service multiple methods, the next snippet shows how to create an endpoint to support multiple URI templates by using the uriPatterns option. The request URI is available in the header of the IN message as well.
Wiki Markup |
---|
{snippet:id=routeDefinition|lang=java|url=camel/trunk/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest.java} |
The uriPatterns=#uriTemplates option references to the List bean (of String) defined in the Spring configuration.
Wiki Markup |
---|
{snippet:id=uriTemplates|lang=xml|url=camel/trunk/components/camel-restlet/src/test/resources/org/apache/camel/component/restlet/RestletMultiUriTemplatesEndpointTest-context.xml} |