users@jersey.java.net

[Jersey] [Jersey 1.6] [JDK 1.6] Is there any other way to publish a class as a REST service without annotating the class.

From: Paul <nibin.cse_at_gmail.com>
Date: Fri, 13 May 2011 01:32:11 -0700 (PDT)

Hi,

In our framework, I have a java class and the java class is not annotated. I
need to deploy this class as a REST service. I have the details on how to
annotate the class externally in a file.

One way to do it will be to implement a custom classloader. In the class
loader, modify the loaded class to add annotation using ASM byte code
library. And set this class loader as the Thread context classloader. So the
Jersey will use my classloader and the classes loaded by this classloader
will be annotated. And service could be created by Jersey easily.

But I am looking for another way. I was going through the Jersey source. I
found that Jersey is using AbstractResource class for resource. I was
wondering, if instead of using IntrospectionModeller (uses Annotated class
to generate AbstractResource), could I implement another class, which will
generate the AbstractResource object from the class that is not annotated
and the information and plug in this? Only the AbstractResource creation I
need to modify. Everything else (matching the request to a resource method)
I could still use Jersey directly. Has anyone faced such a situation? Any
suggestions would be greatly helpful.

In hibernate, if i dont want to annotate the class directly, i think we can
use an XML file for annotation. In Jersey, is there any feature like that?

Regards,
Paul

--
View this message in context: http://jersey.576304.n2.nabble.com/Jersey-1-6-JDK-1-6-Is-there-any-other-way-to-publish-a-class-as-a-REST-service-without-annotating-th-tp6358570p6358570.html
Sent from the Jersey mailing list archive at Nabble.com.