Hi Paul,
On 13.5.2011 11:26, Paul wrote:
> Hi Martin,
>
> Thanks for the response. I see that this is a good solution. Still I would
> need to generate that wrapper class at runtime which requires some Byte code
> manipulation library right?
Ah, so you need to do this dynamically? I.e. you don't know how the
class you need to wrap looks like during the design time?
If so, then yes, you would need class generation at this point. In
JAX-RS/Jersey 2.0 we are hoping to introduce a lower level builder-based
API that would enable you to create resources dynamically, but that is
still many months away.
> Is it not possible to create AbstractResource from a class which is not
> annotated in Jersey? Some implementation which creates the AbstractResource
> from a non annotated class and some data, that I could use instead of the
> IntrospectionModeller?
>
> But when I read through the code, I see that AbstractResource is again using
> Annotations.
>
> Methods like:
>
> public boolean isAnnotationPresent(Class<? extends Annotation> a)
> public<T extends Annotation> T getAnnotation(Class<T> a)
> public Annotation[] getAnnotations()
> public Annotation[] getDeclaredAnnotations()
>
> needs annotation support in the class from which AbstractResource is
> created.
>
> Even if I extend AbstractResource to override these methods, I think it is
> not possible in Java to create Annotation objects from data I have. Or is it
> possible? What do you think?
No, AbstractResource serves a different purpose - it is Jersey's
abstract model of the REST application which is then used to derive the
runtime model from (to implement dispatching of the HTTP calls) and to
generate WADL.
Martin