Would it not be easier to:

Use the Http Service Whiteboard support for resource serving, rather than 
having the ReactServlet? That’s a big bit of boilerplate for serving some 
static content. It should be much simpler using component 
properties/annotations - see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121459
 
<https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121459>
Use the JAX-RS whiteboard to directly register a JAX-RS resource, avoiding the 
need to teach people about launching Jersey (something that they probably care 
very little about). It’s really very simple to do - see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.resource.services
 
<https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html#service.jaxrs.resource.services>
 

Using those features should be able to make the example more concise and 
compelling.

Best Regards,

Tim

> On 23 Jul 2018, at 20:19, Steinar Bang <[email protected]> wrote:
> 
>>>>>> Jean-Baptiste Onofré <[email protected]>:
> 
>> Not using Jersey but cxfrs.
>> I can add this new example using jersey.
> 
> If you want, and tell me where to put it, I can whip up an example and
> provide a pull request?
> 
> Basically this Counter example with Jersey instead of implementing the
> REST service directly in a servlet (and the packages switched to
> something appropriate for karaf examples):
> https://github.com/steinarb/frontend-karaf-demo
> 
> That would demonstrate in addition to Jersey:
> - http whiteboard with DS
> - serving a react.js application from a DS component karaf, packaged
>   with webpack into a bundle.js file
> 
> Alternatively this one with the REST service implemented in a servlet
> replaced with a Jersey resource?
> https://github.com/steinarb/whiteboard-web-and-api-karaf-demo
> 
> The latter example has a very simple plain javascript app embdedded in
> an index.html file.  This can easily be replaced by a webpack'd react.js
> application if of interest.
> 
> The latter example is already split into two separate bundles.  To make
> things really interesting it would be good to delegate the actual
> counting into an OSGi service that can be injected into the Jersey
> resources, making it have a total of 4 bundles (an API bundle defining
> the service, a bundle implementing the service in a DS component, a
> webapi bundle using Jersey and injecting the service from the DS
> component into Jersey resources, and a webgui bundle (that can be
> changed into a react.js app).
> 

Reply via email to