...
Name |
Description |
Example |
Required? |
default value |
resourceClasses |
The resource classes which you want to export as REST service. Multiple classes can be separated by comma. |
resourceClasses=org.apache.camel.rs.Example1, org.apache.camel.rs.Exchange2 |
No |
None |
resourceClass |
Deprecated: Use resourceClasses The resource class which you want to export as REST service. |
resourceClass =org.apache.camel.rs.Example1 |
No |
None |
httpClientAPI |
new to Camel 2.1 If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service If it is false, the CxfRsProducer will use the ProxyClientAPI to invoke the service |
httpClientAPI=true |
No |
true |
synchronous |
New in 2.5, this option will let CxfRsConsumer decide to use sync or async API to do the underlying work. The default value is false which means it will try to use async API by default. |
synchronous=true |
No |
false |
throwExceptionOnFailure |
New in 2.6, this option tells the CxfRsProducer to inspect return codes and will generate an Exception if the return code is larger than 207. |
throwExceptionOnFailure=true |
No |
true |
maxClientCacheSize |
New in 2.6, you can set a IN message header CamelDestinationOverrideUrl to dynamically override the target destination Web Service or REST Service defined in your routes. The implementation caches CXF clients or ClientFactoryBean in CxfProvider and CxfRsProvider. This option allows you to configure the maximum size of the cache. |
maxClientCacheSize=5 |
No |
10 |
setDefaultBus |
New in 2.9.0. Will set the default bus when CXF endpoint create a bus by itself |
setDefaultBus=true |
No |
false |
bus |
New in 2.9.0. A default bus created by CXF Bus Factory. Use # notation to reference a bus object from the registry. The referenced object must be an instance of org.apache.cxf.Bus . |
bus=#busName |
No |
None |
bindingStyle |
As of 2.11. Sets how requests and responses will be mapped to/from Camel. Two values are possible:
|
bindingStyle=SimpleConsumer |
No |
Default |
providers |
Since Camel 2.12.2 set custom JAX-RS providers list to the CxfRs endpoint. |
providers=#MyProviders |
No |
None |
schemaLocations |
Since Camel 2.12.2 Sets the locations of the schemas which can be used to validate the incoming XML or JAXB-driven JSON. |
schemaLocations=#MySchemaLocations |
No |
None |
features |
Since Camel 2.12.3 Set the feature list to the CxfRs endpoint. |
features=#MyFeatures |
No |
None |
properties |
Since Camel 2.12.4 Set the properties to the CxfRs endpoint. |
properties=#MyProperties |
No |
None |
inInterceptors |
Since Camel 2.12.4 Set the inInterceptors to the CxfRs endpoint. |
inInterceptors=#MyInterceptors |
No |
None |
outInterceptors |
Since Camel 2.12.4 Set the outInterceptor to the CxfRs endpoint. |
outInterceptors=#MyInterceptors |
No |
None |
inFaultInterceptors |
Since Camel 2.12.4 Set the inFaultInterceptors to the CxfRs endpoint. |
inFaultInterceptors=#MyInterceptors |
No |
None |
outFaultIntercetpros |
Since Camel 2.12.4 Set the outFaultInterceptors to the CxfRs endpoint. |
outFaultInterceptors=#MyInterceptors |
No |
None |
...
The CXF JAXRS front end implements the JAX-RS (JSR-311) API, so we can export the resources classes as a REST service. And we leverage the CXF Invoker API to turn a REST request into a normal Java object method invocation.
Unlike the camel-restlet
Camel Restlet component, you don't need to specify the URI template within your restlet endpoint, CXF take takes care of the REST request URI to resource class method mapping according to the JSR311 JSR-311 specification. All you need to do in Camel is delegate this method request to a right processor or endpoint.
...
The CXF JAXRS front end implements a proxy-based client API, with this API you can invoke the remote REST service through a proxy.
The camel-cxfrs
producer is based on this proxy API.
So, you You just need to specify the operation name in the message header and prepare the parameter in the message body, the camel-cxfrs producer producer will generate right REST request for you.
Here is an example:
Wiki Markup |
{snippet:id=ProxyExample|lang=java|url=""> |
The CXF JAXRS front end also provides a http centric client API, You can also invoke this API from camel-cxfrs
producer. You need to specify the HTTP_PATH and Http method and let the producer know to use the http centric client by using the URI option httpClientAPI or set the message header with CxfConstants.CAMEL_CXF_RS_USING_HTTP_API. You can turn the response object to the type class that you specify with CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS.
...