I note that both of the Remote Services options provided have examples using 
JAX-RS annotated service interfaces, which doesn't actually match the code 
provided in the example below. 

Using Remote Services also doesn't give you a standard way to handle request 
scoped resources (i.e. prototype services) or a defined way to add JAX-RS 
filters, MessageBodyReaders etc. This is one of the reasons why a JAX-RS 
whiteboard specification is being created.

A JAX-RS whiteboard also allows you to do things like returning a JAX-RS 
Response for streaming results, asynchronous returns, or just to give a 
response other than 200 without having to use an Exception in a main-line code 
path.

Whilst it is therefore true that a subset of JAX-RS resources can be exposed 
using Remote Services, it's not necessarily a good option if you're looking to 
put together a full REST API.

Regards,

Tim

Sent from my iPhone

> On 4 Nov 2016, at 02:23, Scott Lewis <sle...@composent.com> wrote:
> 
>> On 11/3/2016 2:17 AM, Christian Schneider wrote:
>> You can use CXF-DOSGi to register your rest resource. You just need to add 
>> some properties to your example component to make it work.
> 
> Another option is to use ECF's impl of OSGI Remote Services [1] with the 
> Jax-RS distribution provider [2,3]...which supports either Jersey or CXF 
> impls of Jax-RS.
> 
> Scott
> 
> [1] 
> http://wiki.eclipse.org/Eclipse_Communication_Framework_Project#OSGi_Remote_Services
> [2] http://wiki.eclipse.org/Distribution_Providers#Jax-RS_REST_Providers
> [3] https://github.com/ECF/JaxRSProviders
> 
> 
>> 
>> See
>> https://github.com/apache/cxf-dosgi/tree/master/samples
>> 
>> There is a also a bndrun file to easily run and package CXF-DOSGi for 
>> bndtools.
>> https://github.com/apache/cxf-dosgi/tree/master/samples/soap
>> 
>> Christian
>> 
>>> On 03.11.2016 03:05, Tanvir wrote:
>>> I have a REST resource class, say Employees, and I need access to another 
>>> service using DS. Hence I have to make this call  a component.  Now objects 
>>> instantiated by @component and JAX-RS Servlet are not same.
>>> 
>>> I do not want to use static reference to the service as shown below. How 
>>> this can be handled?
>>> 
>>> -----------------------------------------------
>>> @Component
>>> @Path("employees")
>>> public class EmployeeResource {
>>>    static MyService service;
>>>    @Reference
>>>    void setMyService(MyService s) {
>>>       service = s;
>>>    }
>>> 
>>>    @GET
>>>    @Produces("text/plain")
>>>    public String getEmployees() {
>>>        return service.get();
>>>    }
>>> }
>>> 
>> 
>> 
> 
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to