Hi,
I would like to create a subresource which returns a class type (annotated
with javax.injection.Singleton). The example comes from Jersey
documentation. Let me show you how it looks:
@Path("/v1")
public class DispatcherResourceV1 {
@Path("/chapter")
public Class<ChapterResourceV1> v1Chapters() {
return ChapterResourceV1.class;
}
//.. and other resources
}
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Singleton
public class ChapterResourceV1 {
@GET
@Path("/")
@Produces(MediaType.TEXT_PLAIN)
public String chapter() {
return "Hello V1";
}
}
But running this code next log message is printed:
WARNING: No resource methods have been found for resource class
java.lang.Class
Nov 03, 2014 11:30:14 AM org.apache.cxf.jaxrs.JAXRSInvoker invoke
SEVERE: No subresource locator found for path /
Obviously it seems I am missing something but I don't know exactly what,
because if I change returning an class type to returning an instance it
works perfectly.
--
+----------------------------------------------------------+
Alex Soto Bueno
www.lordofthejars.com
+----------------------------------------------------------+