...
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=camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java} |
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.
...