Hi,
I am working on a small project which aims to get OSGi services exposed as
REST resources thanks to jersey. The publication of services as resources
works fine, but I have some problems with bindings the value of the URI to
methods parameters. For example, with the following resource:
====
*_at_Path("users/{username}")*
*public class MyResource {*
*
*
* @GET*
* @Produces(TEXT_PLAIN)*
* public String hello(@PathParam("username") String userName) {*
* return "Salut " + userName + " !";*
* }*
*}*
====
Jersey failed to bind the @PathParam, I got the following warning:
WARNING: The following warnings have been detected with resource and/or
provider classes:
WARNING: A HTTP GET method, public java.lang.String
org.ow2.chameleon.test.rest.MyRessource.hello(java.lang.String), *should not
consume any entity.*
and if I try to access */users/toto, *the userName is empty:
====
*Salut !*
====
Since the instance of the resource is retrieve from the OSGi service broker,
I have a simple IoCManagedComponentProvider which looks like that:
====
*public class ManagedComponentProvider implements
IoCManagedComponentProvider {*
* private final Object instance;*
*
*
* public ManagedComponentProvider(Object pInstance) {*
* instance = pInstance;*
* }*
*
*
* /***
* * Since the instance is an OSGi service, this is a singleton pattern !
*
* */*
* public ComponentScope getScope() {*
* return Singleton;*
* }*
*
*
* public Object getInjectableInstance(Object o) {*
* //TODO Injectable ?*
* return o;*
* }*
*
*
* public Object getInstance() {*
* return instance;*
* }*
*}*
*====*
*
*
Have you any idea why I get this warning ?
*
*
Thanks,
Jonathan