You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by Morgan Hautman <mo...@gmail.com> on 2015/12/01 12:35:44 UTC
JAX-RS and Declarative services
Hi all,
I'm working on a Karaf-boot sample to provide JAX-RS services using DS.
I already got the blueprint version working but I'm struggling with the
DS one.. and I need some help.
The code that I already got is here :
https://gist.github.com/mhautman/d580e6045fd999f9c10a
My guess is that I need an @Activate but I don't know what to put in there..
Hope someone can help me out,thanks!
Regards,
Morgan
Re: JAX-RS and Declarative services
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
As discussed: don't forget the scr feature ;)
Regards
JB
On 12/01/2015 12:35 PM, Morgan Hautman wrote:
> Hi all,
>
> I'm working on a Karaf-boot sample to provide JAX-RS services using DS.
> I already got the blueprint version working but I'm struggling with the
> DS one.. and I need some help.
> The code that I already got is here :
> https://gist.github.com/mhautman/d580e6045fd999f9c10a
>
> My guess is that I need an @Activate but I don't know what to put in
> there..
>
> Hope someone can help me out,thanks!
>
> Regards,
> Morgan
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: JAX-RS and Declarative services
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Morgan,
You don't need the @Activate (as it's to call a method during start).
@Component is enough. Using bundle:services, you should see the services
available.
Now, I think you are missing somestuff:
- does your pom.xml contain the karaf-boot-maven-plugin ?
- did you deploy the CXF RS feature in the runtime ?
As I said on IRC, I will help you.
Regards
JB
On 12/01/2015 12:35 PM, Morgan Hautman wrote:
> Hi all,
>
> I'm working on a Karaf-boot sample to provide JAX-RS services using DS.
> I already got the blueprint version working but I'm struggling with the
> DS one.. and I need some help.
> The code that I already got is here :
> https://gist.github.com/mhautman/d580e6045fd999f9c10a
>
> My guess is that I need an @Activate but I don't know what to put in
> there..
>
> Hope someone can help me out,thanks!
>
> Regards,
> Morgan
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: JAX-RS and Declarative services
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
By the way, I don't see the bean (with @Activate) containing the CXF
endpoint creation and registration.
Or you can use CXF DOSGi (and so, you don't need @Activate).
On the REST bean, you can add:
@Component(service=HelloServiceRest.class,
property={"service.exported.interfaces=*",
"service.exported.configs=org.apache.cxf.rs",
"org.apache.cxf.rs.address=/helloRest"})
Regards
JB
On 12/01/2015 12:35 PM, Morgan Hautman wrote:
> Hi all,
>
> I'm working on a Karaf-boot sample to provide JAX-RS services using DS.
> I already got the blueprint version working but I'm struggling with the
> DS one.. and I need some help.
> The code that I already got is here :
> https://gist.github.com/mhautman/d580e6045fd999f9c10a
>
> My guess is that I need an @Activate but I don't know what to put in
> there..
>
> Hope someone can help me out,thanks!
>
> Regards,
> Morgan
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com