|
From: Bill B. <bb...@re...> - 2008-04-09 13:25:44
|
Andreas Holstenson wrote:
> Hello,
>
> I have recently started testing Resteasy JAX-RS. I'm extremely happy so far,
> but I have run into a few problems. I have a application that was working
> with Jersey that is now deployed on Resteasy. The problem here is the
> following:
>
> I have a method in my root resource that returns an interface called Device
> such as:
>
> @Path("{id}")
> Device getDevice(@PathParam("id") String id);
>
> The device interface in turn has JAX-RS annotations on it:
>
> interface Device {
> @GET
> Device getSelf();
> }
>
> The device implementation have several implementations that each one have
> different JAX-RS resource. My problem is that it seems to be impossible reach
> those resources as it seems that Resteasy always works against the interface
> for lookups.
>
I need more information on this. The spec says that either you put your
annotations on an interface or on the class/superclass and not both.
Can you show me more pseudo code?
So derivatives of Device are returned from getDevice()? The problem
with this is a performance one. Resteasy would have to calculate and
introspect and match the request on every single request. There would
be no way to optimize.
I guess I'll have to support it... I'll see what I can do today and get
out a new release.
> Is this the intended behavior? I don't remember what the JSR says about this,
> but it worked fine with Jersey.
>
> Also on a related note it seems that MessageBodyWriter.isWriteable(Class,
> Type, Annotation[]) gets passed the declared type of the method instead of
> the actual class of the return value. This caused problems with JAXBProvider
> as my concrete implementations had a @XmlRootElement annotation but the
> actual Device implementation did not.
>
Well, I'm in a quandry with this one. Reason? Generic types. Say you
want to write a multipart provider that matches on List<String>? it is
impossible to determine the generic type of the object.
I switch it to matching on the returned entity's class.
Bill
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|