cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: registering multiple OSGi services with DOSGi
Date Thu, 02 May 2013 09:01:06 GMT
Hi
On 02/05/13 09:10, Julio Carlos Barrera Juez wrote:
> Additionally, we cannot provide good javax.ws.rs.Path annotations because
> our OSGi service interfaces are used to generate different
> services dynamically. for instance, given this interface:
>
> @Path("/")
> public interface DynamicService {
>
>    @Path("/methodA")
>    public Object methodA();
>
> }
>
> Different services are registered using the same interface, then
> different "org.apache.cxf.rs.address"
> properties are generated to differentiate each service like "/serviceA" and
> "/serviceB". Both services have same interface, but different instances.
>

What I know is possible with DOSGi CXF 1.4 is to use both
"org.apache.cxf.rs.httpservice.context" and "org.apache.cxf.rs.address" 
properties, both being relative, example, see

http://svn.apache.org/repos/asf/cxf/dosgi/tags/cxf-dosgi-ri-1.4.0/samples/greeter_rest/impl2/src/main/java/org/apache/cxf/dosgi/samples/greeter/impl2/rest/Activator.java

So you should be able to set "org.apache.cxf.rs.httpservice.context" to 
say "/rest" for all the bundles and "/a", "/b", etc for
"org.apache.cxf.rs.address" for the individual bundles.
Give that a try please.

One other thing is that you can avoid annotating interfaces with JAX-RS 
annotations and use the external user models, the greeter_rest demo 
shows that too. The only limitation there is that a user model is 
static, one can not 'attach' them dynamically, may be we should support 
that...

Sergey

>
> On 2 May 2013 09:24, Julio Carlos Barrera Juez<
> juliocarlos.barrera@i2cat.net>  wrote:
>
>> Hi!
>>
>> We have a ServiceMix app with multiple bundles. We want to export our OSGi
>> service interfaces using DOSGi. We annotate our service interfaces
>> with javax.ws.rs.Path, javax.ws.rs.GET,
>> javax.ws.rs.POST, javax.ws.rs.Consumes and javax.ws.rs.Produces. Then we
>> register our OSGi services using Apache Aries Blueprint or Java code
>> adding different CXF properties.
>>
>> At the beginning we used "org.apache.cxf.rs.address" property with
>> absolute URLs, using Jetty standalone instance. But now we want to use
>> relative address to use HTTP service. If we don't
>> specify "org.apache.cxf.rs.httpservice.context" property, our service seems
>> to be not registered at all. I we specify this property with same value for
>> all services there are some errors when registering services ("alias in use
>> or another context..."). If we specify different values for each
>> registration there are no errors, but there are a mix of methods in each
>> service (looking at WADL).
>>
>> How we must set both properties to achieve having different services
>> registered with relative paths?
>>
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Mime
View raw message