karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Weirig <alex.wei...@technolink.lu>
Subject Re: REST - Declarative Services
Date Tue, 29 May 2018 06:40:24 GMT
BTW: these should be the features I installed in karaf ...

feature:repo-add cxf-dosgi
feature:install cxf-dosgi-provider-rs


Mat frëndleche Gréiss, Mit freundlichen Grüßen, Meilleures salutations, 
Kind regards,
Alex Weirig
Responsable Technique Ville de Luxembourg Service Enseignement Centre 
Technolink *Tel* +352 4796 - 6127 <tel:+35247966127> *Fax* +352 42 88 81 
*Email* alex.weirig@technolink.lu <mailto:alex.weirig@technolink.lu> 
www.vdl.lu <http://www.vdl.lu> // www.technolink.lu 
<http://www.technolink.lu> Centre Technolink 2, rue Charles de Tornaco 
L-2623 LUXEMBOURG

On 29/05/2018 08:36, Alex Weirig wrote:
>
> I'm using the approach Christian is referring to and I can confirm 
> that it's really easy and convenient.
>
> I'm creating DS services to expose selected backend services with a 
> REST API
>
> @Component(
>         immediate = true
>         , property = {
>                 "service.exported.interfaces=*",
>                 "service.exported.configs=org.apache.cxf.rs",
>                 "org.apache.cxf.rs.address=/room-service"
>         }
>         , service = GestionInfrastructuresREST.class
> )
> public class GestionInfrastructuresRESTImpl implements 
> GestionInfrastructuresREST {
>
>     @Reference private LogService logger;
>     @Reference private GestionInfrastructuresService service;     // 
> my backend service
>
>     ...
>
>
>     @Override
>     public Response getAllRooms() {
>         List<GestionInfrastructuresRoomModel> allRooms = 
> service.getAllRooms();    // call to the backend service
>
>         ... // process the result from the backend service
>
>        return Response.ok(json, 
> MediaType.APPLICATION_JSON).build();    // if result is OK
>
>         ...  // do some error processing and return some error .... e.g.
>         return Response.serverError().build();
>     }
>
> }
>
> Mat frëndleche Gréiss, Mit freundlichen Grüßen, Meilleures 
> salutations, Kind regards,
> Alex Weirig
> Responsable Technique Ville de Luxembourg Service Enseignement Centre 
> Technolink *Tel* +352 4796 - 6127 <tel:+35247966127> *Fax* +352 42 88 
> 81 *Email* alex.weirig@technolink.lu 
> <mailto:alex.weirig@technolink.lu> www.vdl.lu <http://www.vdl.lu> // 
> www.technolink.lu <http://www.technolink.lu> Centre Technolink 2, rue 
> Charles de Tornaco L-2623 LUXEMBOURG
> On 28/05/2018 23:01, Christian Schneider wrote:
>> Aries JAX-RS should work. It is not yet released though. So currently 
>> there is only a snapshot. A release should follow soon.
>>
>> Another option is to use CXF-DOSGi. You can find an example below. It 
>> is similar to Aries JAX-RS so a later switch should be easy.
>>
>> https://github.com/apache/cxf-dosgi/tree/master/samples/rest
>>
>> Christian
>>
>> 2018-05-28 19:40 GMT+02:00 Guenther Schmidt <schmig68@gmail.com 
>> <mailto:schmig68@gmail.com>>:
>>
>>     Hello All,
>>
>>     I’ve been developing services using Declarative Services for
>>     dependency injection and it was a breeze so far. Now I want to
>>     expose some of the functionality via a REST API and I’m stuck. So
>>     far I’ve deployed my bundles through bundle:install -s man: ….
>>     all very easy. But what should be simple, exposing this through
>>     REST is becoming difficult. There are tips out there suggesting
>>     to use Blueprint, which I don’t want, others seem to suggest that
>>     I need to create a “feature” package.
>>
>>     Then there’s also the requirements to “feature” install cxf.
>>     That’s OK btw, I only have to do that once. But is there really
>>     no simple way to create a simple REST service using merely DS?
>>
>>     Guenther
>>
>>
>>
>>
>>
>> -- 
>> -- 
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Computer Scientist
>> http://www.adobe.com
>>
>> -- 
>> This email was Anti Virus checked by SOPHOS UTM
>


Mime
View raw message