camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: cxfrs proxy-base rsClient with multiple resource interfaces
Date Fri, 24 Apr 2015 11:35:36 GMT
Hi Nick

Suppose you have 5 CXFRS resource classes.
Having a single proxy being able to access all of them is only possible 
if a proxy has been created from a class that implements or has all of 
those 5 class resource methods.

So may be

public abstract class ClientProxy implements IResource1,...,IResource5 {
}

Use ClientProxy.class to create a client proxy. Note a cglib dependency 
needs to be on a classpath for a proxy created from a non-interface class

HTH, Sergey


On 23/04/15 22:57, njames wrote:
> Hi,
> I hope that I have done sufficient googling for this not to be an FAQ, but I
> have a question about configuring a cxf:rsClient with a list of
> "serviceClass"es. We tend to have a number of related REST resource
> interfaces implemented within a single service (aka Tomcat servlet context).
> I have had some success configuring and using a cxf:rsClient to access my
> service using a proxy of the first REST resource interface. For example:
>
> 	<cxf:rsClient id="myRestService"
> 		address="${myServerHost}/resource"
> 		username="${authUsername}" password="${authPassword}"
> 		loggingFeatureEnabled="true" inheritHeaders="true"
> 		serviceClass="com.me.FirstResource">
> 		<cxf:providers>
> 			<ref bean="jaxbAccountProvider"/>
> 		</cxf:providers>
> 	</cxf:rsClient>
>
> I want to extend this configuration to have multiple resource interfaces,
> but the intuitive approach of listing them in the serviceClass attribute
> doesn't work.
> I get the impression from the Camel component page for cxfrs (although I
> haven't validated it) that you can configure an rsServer using a
> resourceClasses url query parameter, but that doesn't work for an rsClient
> (producer vs consumer, yadda, yadda, yadda)
> I don't want to have to repeat myself by defining 3 rsClients with each of
> the resource interfaces and re-specify the address and credentials. I want
> to be as DRY as possible. Also it means that the routes that use the "same
> service" have to know which rsClient bean to use to get the desired
> interface.
> My latest attempt is using the modelBeans element in a single rsClient to
> configure the interfaces for the service, but I think it's intended for
> interfaces that do not have the JAX-RS annotations and so I would be
> repeating the operations and parameters and everything in the XML
> configuration. Does anyone know how to do something like:
>
> 	<cxf:rsClient id="myRestService"
> 		address="${myServerHost}/resource"
> 		username="${authUsername}" password="${authPassword}"
> 		loggingFeatureEnabled="true" inheritHeaders="true" >
> 		<cxf:providers>
> 			<ref bean="jaxbAccountProvider"/>
> 		</cxf:providers>
> 		<cxf:modelBeans>
> 			<util:list>
> 				<bean class="com.me.FirstResource"/>
> 				<bean class="com.me.SecondResource"/>
> 				<bean class="com.me.ThirdResource"/>
> 			</util:list>
> 		</cxf:modelBeans>
> 	</cxf:rsClient>
>
> Currently Spring complains about using the class attribute for the
> FirstResource, etc, but they are interfaces. (Please don't push me down the
> Spring AOP route.)
> Am I being unreasonable?
>
> Thanks for any help,
>
> Nick.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxfrs-proxy-base-rsClient-with-multiple-resource-interfaces-tp5766253.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Mime
View raw message