Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 71385185DC for ; Thu, 11 Feb 2016 09:20:06 +0000 (UTC) Received: (qmail 51502 invoked by uid 500); 11 Feb 2016 09:20:06 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 51450 invoked by uid 500); 11 Feb 2016 09:20:06 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 51441 invoked by uid 99); 11 Feb 2016 09:20:06 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Feb 2016 09:20:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D39171A02EB for ; Thu, 11 Feb 2016 09:20:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.671 X-Spam-Level: X-Spam-Status: No, score=0.671 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id c_JqU7Gw0mU6 for ; Thu, 11 Feb 2016 09:19:56 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id C311B31ADD for ; Thu, 11 Feb 2016 09:19:55 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D3068E120C for ; Thu, 11 Feb 2016 09:19:54 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id D691F3A023C for ; Thu, 11 Feb 2016 09:19:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r980115 [3/3] - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache cxfrs.html Date: Thu, 11 Feb 2016 09:19:54 -0000 To: commits@camel.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160211091954.D691F3A023C@svn01-us-west.apache.org> Modified: websites/production/camel/content/cxfrs.html ============================================================================== --- websites/production/camel/content/cxfrs.html (original) +++ websites/production/camel/content/cxfrs.html Thu Feb 11 09:19:54 2016 @@ -102,7 +102,7 @@

Where rsEndpoint represents the spring bean's name which presents the CXFRS client or server

For either style above, you can append options to the URI as follows:

-

Options

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 E xception 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. deprecated use defaultBus option from Camel 2.16 onwards. Will set the default bus when CXF endpoint create a bus by itself

setDefaultBus=true

No

false

defaultBusCamel 2.16: Will set the default bus when CXF endpoint create a bus by itselfdefaultBus=trueNofalse

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:

  • SimpleConsumer => see the Consuming a REST Request with th e Simple Binding Style below.
  • Default => the default style. For consumers this passes on a MessageContentsList to the route, requiring low-level processing in the route.
  • Custom => allows you to specify a custom binding through the binding option.

bindingStyle=SimpleConsumer

No

Default

binding

Allows you to specify a custom CxfRsBinding implementation to perform low-level processing of the raw CXF request and response objects. The implementation must be bound in the Camel registry, and you must use the hash (# ) notation to refer to it.binding=#myBindingNoDefaultCxfRsBinding

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

continuationTimeout

Since Camel 2.14.0 This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport. (Before Camel 2.14.0, CxfConsumer just set the continuation timeout to be 0, which means the continuation suspend operation never timeout.)

continuationTimeout=800000

No

30000

ignoreDeleteMethodMessageBodySince Camel 2.14.1 This option is used to tell CxfRsProducer to ignore the message body of the DELETE method when using HTTP API.ignoreDeleteMethodMessageBody=trueNofalse

modelRef

Since Camel 2.14.2 This option is used to specify the model file which is useful for the resource class without annotation.

Since Camel 2.15 This option can point to a model file without specifying a service class for emulating document-only endpoints

modelRef=classpath:/CustomerServiceModel.xml

NoNone

performInvocation

Since Camel 2.15 When the option is true, camel will perform the invocation of the resource class instance and put the response object into the exchange for further processing.

performInvocation= true

Nofalse
propagateContextsSince Camel 2.15 When the option is true, JAXRS UriInfo, HttpHeaders, Request and SecurityContext contexts will be available to custom CXFRS processors as typed Camel exchange properties. These contexts can be used to analyze the current requests using JAX-RS API.   

You can also configure the CXF REST endpoint through the spring con figuration. Since there are lots of difference between the CXF REST client and CXF REST Server, we provide different configuration for them.
Please check out the schema file and CXF JAX-RS documentation for more information.

How to configure the REST endpoint in Camel

In camel-cxf schema file, there are two elements for the REST endpoint definition. cxf:rsServer for REST consumer, cxf:rsClient for REST producer.
You can find a Camel REST service route configura tion example here.

+

Options

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 E xception 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. deprecated use defaultBus option from Camel 2.16 onwards. Will set the default bus when CXF endpoint create a bus by itself

setDefaultBus=true

No

false

defaultBusCamel 2.16: Will set the default bus when CXF endpoint create a bus by itselfdefaultBus=trueNofalse

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:

  • SimpleConsumer => see the Consuming a REST Request with th e Simple Binding Style below.
  • Default => the default style. For consumers this passes on a MessageContentsList to the route, requiring low-level processing in the route.
  • Custom => allows you to specify a custom binding through the binding option.

bindingStyle=SimpleConsumer

No

Default

binding

Allows you to specify a custom CxfRsBinding implementation to perform low-level processing of the raw CXF request and response objects. The implementation must be bound in the Camel registry, and you must use the hash (# ) notation to refer to it.binding=#myBindingNoDefaultCxfRsBinding

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

continuationTimeout

Since Camel 2.14.0 This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default when the CXF server is using Jetty or Servlet transport. (Before Camel 2.14.0, CxfConsumer just set the continuation timeout to be 0, which means the continuation suspend operation never timeout.)

continuationTimeout=800000

No

30000

ignoreDeleteMethodMessageBodySince Camel 2.14.1 This option is used to tell CxfRsProducer to ignore the message body of the DELETE method when using HTTP API.ignoreDeleteMethodMessageBody=trueNofalse

modelRef

Since Camel 2.14.2 This option is used to specify the model file which is useful for the resource class without annotation.

Since Camel 2.15 This option can point to a model file without specifying a service class for emulating document-only endpoints

modelRef=classpath:/CustomerServiceModel.xml

NoNone

performInvocation

Since Camel 2.15 When the option is true, camel will perform the invocation of the resource class instance and put the response object into the exchange for further processing.

performInvocation= true

Nofalse
propagateContextsSince Camel 2.15 When the option is true, JAXRS UriInfo, HttpHeaders, Request and SecurityContext contexts will be available to custom CXFRS processors as typed Camel exchange properties. These contexts can be used to analyze the current requests using JAX-RS API.   
loggingFeatureEnable dThis option enables CXF Logging Feature which writes inbound and outbound REST messages to log. Nofalse
skipFaultLoggingThis option controls whether the PhaseInterceptorChain skips logging the Fault that it catches. Nofalse
loggingSizeLimitTo limit the total size of number of bytes the logger will output when l ogging feature has been enabled. No0

You can also configure the CXF REST endpoint through the spring configuration. Since there are lots of difference between the CXF REST client and CXF REST Server, we provide different configuration for them.
Please check out the schema file and CXF JAX-RS documentation for more information.

How to configure the REST endpoint in Camel

In camel-cxf schema file, there are two elements for the REST endpoint definition. cxf:rsServer for REST consumer, cxf:rsClient for REST producer.
You can find a Camel REST service route configuration example here.

-

And the corresponding resource class used to configure the endpoint...

Note about resource classes

By default, JAX-RS resource classes are only used to configure JAX-RS properties. Methods will not be executed during routing of messages to the endpoint. Instead, it is the responsibility of the route to do all processing.

Note that starting from Camel 2.15 it is also sufficient to provide an interface only as opposed to a no-op service implementation class for the default mode.

Starting from Camel 2.15, if a performInvocation option is enabled, the service implementation will be invoked first, the response will be set on the Camel exchange and the route execu tion will continue as usual. This can be useful for

integrating the existing JAX-RS implementations into Camel routes and for post-processing JAX-RS Responses in custom processors.

 

+
And the corresponding resource class used to configure the endpoint...

Note about resource classes

By default, JAX-RS resource classes are only used to configure JAX-RS properties. Methods will not be executed during routing of messages to the endpoint. Instead, it is the responsibility of the route to do all processing.

Note that starting from Camel 2.15 it is also sufficient to provide an interface only as opposed to a no-op service implementation class for the default mode.

Starting from Camel 2.15, if a performInvocation option is enabled, the service implementation will be invoked first, the response will be set on the Camel exchange and the route execution wi ll continue as usual. This can be useful for

integrating the existing JAX-RS implementations into Camel routes and for post-processing JAX-RS Responses in custom processors.

 

-

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 the HTTP_METHOD and let the producer use the http centric client API by using the URI option httpClientAPI or by setting the message header CxfConstants.CAMEL_CXF_RS_USING_HTTP_API. You can turn the response object to the type class specified with the message header CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS.

+
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 the HTTP_METHOD and let the producer use the http centric client API by using the URI option httpClientAPI or by setting the message header CxfConstants.CAMEL_CXF_RS_USING_HTTP_API. You can turn the response object to the type class specified with the message header CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS.
-

From Camel 2.1, we also support to specify the query parameters from cxfrs URI for the CXFRS http centric client.

+
From Camel 2.1, we also support to specify the query parameters from cxfrs URI for the CXFRS http centric client.
-

To support the Dynamical routing, you can override the URI's query parameters by using the CxfConstants.CAMEL_CXF_RS_QUERY_MAP header to set the parameter map for it.

+
To support the Dynamical routing, you can override the URI's query parameters by using the CxfConstants.CAMEL_CXF_RS_QUERY_MAP header to set the parameter map for it.