osgi.enroute.rest vs JAXRS

255 views
Skip to first unread message

t...@quarendon.net

unread,
Jun 14, 2016, 8:57:11 PM6/14/16
to bndtools-users
Up until now I've been using JAX-RS to define my REST api (via amdatu web), but have just encountered osgi.enroute.rest.
However I can find very little information, beyond the single page description on the enRoute website, and the accompanying example.

What are the considerations with regard to which to choose? At first sight the most obvious issue with osgi.enroute.rest is the simple serialization and deserialization that is performed, I can't do complex polymorhpic tree serialization like I can with JAX-RS and jackson (well I think I probably can if I make my return types byte[], but it seems much harder work, don't know about passing a body in on POST/PUT).

What are the advantages? The page on the enroute website makes some references to security, but without much explanation. 

Thanks.

Peter Kriens

unread,
Jun 15, 2016, 2:56:02 AM6/15/16
to bndtool...@googlegroups.com
If you need a simple REST API that has JSON body and response the enRoute works fine; it was designed from ground up to be real OSGi service based. If you need more (and that is how it sounds), this is likely too limited. As soon as you need to return byte[] from multiple methods or have to do your own conversions you’re outside its design scope. It is included in OSGi enRoute because it is very easy to use and does not require complex annotations.

There is an RFC in progress in the OSGi to standardize the implementations of JAX-RS in OSGi. This requires a spec because it has, like all Java EE standards, a model that is class based and not instance (or service) based. Tim Ward is working on this. I know that several implementations for OSGi roam around the internet.

If you go for JAX RS, I would definitely like an example project in OSGi enRoute!

Kind regards,

Peter Kriens




--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bram Pouwelse

unread,
Jun 15, 2016, 3:06:12 AM6/15/16
to bndtool...@googlegroups.com
For the next Amdatu Web release we are working towards supporting the RFC Peter mentioned, the runtime service is not yet there but the whiteboard implementation has been changed to work as described by in the RFC. 

There is a (working) demo in the project repo [1]

Regards,
Bram

Christian Schneider

unread,
Jun 15, 2016, 4:02:29 AM6/15/16
to bndtool...@googlegroups.com
For JAX-RS I recommend to use Remote Service Admin together with a REST transport. 
You can already do this with Aries RSA and the CXF transport. 

See:

Simply create a normal JAX-RS class and export it as an OSGi service using DS. 

It is already possible to use this in bndtools. See

I will need some refactoring in the CXF transport to make it more modular. Currently there is only one module for JAXRS and SOAP but it should still work nicely.

I hope the upcoming spec will be compatible with RSA as I think REST fits very nicely into it.

Christian
--
--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

t...@quarendon.net

unread,
Jun 15, 2016, 4:03:00 AM6/15/16
to bndtools-users
OK thanks. Sounds like I'll stick with JAX-RS as that seems to give me more.

Thanks.

t...@quarendon.net

unread,
Jun 15, 2016, 4:04:57 AM6/15/16
to bndtools-users

There is a (working) demo in the project repo [1]

OK thanks. I've been happily using Amdatu web for JAX-RS support for a while.
The bit I haven't been able to get to work successfully is registering a request filter. I've tried doing it using the osgi HTTP whiteboard, and while that works in the sense that it registers and activates my filter, it doesn't get to see any requests.  

Timothy Ward

unread,
Jun 15, 2016, 5:12:26 AM6/15/16
to bndtool...@googlegroups.com
There has also been a vote to start a new component in Apache Aries to host a JAX-RS whiteboard implementation.

Regards,

Tim

On 15 Jun 2016, at 09:02, t...@quarendon.net wrote:

OK thanks. Sounds like I'll stick with JAX-RS as that seems to give me more.

Thanks.

Bryan Hunt

unread,
Jun 15, 2016, 8:52:07 AM6/15/16
to bndtool...@googlegroups.com
There is also this project … https://github.com/hstaudacher/osgi-jax-rs-connector.  I use this in my open source project https://github.com/BryanHunt/web-in-a-box to provide a generic document service based on JSON API.

Bryan

Peter Kriens

unread,
Jun 15, 2016, 9:04:53 AM6/15/16
to bndtool...@googlegroups.com
Any of these projects willing to make a nice small OSGi enRoute example? (Or all to see the difference …) 

Kind regards,

Peter Kriens
Reply all
Reply to author
Forward
0 new messages