users@jersey.java.net

WADL Generation

From: Fabio Mancinelli <fabio.mancinelli_at_gmail.com>
Date: Sun, 8 Feb 2009 20:05:45 +0100

Dear all,

I am experimenting with Jersey and I have a question about WADL generation.
I wrote a simple "HelloWorld" application that has a single resource:

@Path("/myresource")
class MyResource {
  @GET
  public MyType get() {
    ...
    return myTypeInstance;
  }
}

Then I setup some MessageBodyWriters for MyType in order to provide
representations for some media types: let's say "application/xml" and
"text/plain". Everything works fine.

However when I ask for the application.wadl the response type
associated to "GET /myresource" is "*/*" instead of the two media
types implemented by the MessageBodyWriter providers for MyType.

In order to get the correct result I have to explicitly list the media
types using a @Produces annotation.

This is a kind of duplication. Moreover if I want to add some more
representations I have to write the provider AND add the media type to
all the methods of the resources that return MyType.

I would have expected some kind of automatic binding between the
returned type of a @GET annotated method and the media types
associated to the existing MessageBodyProviders for that type.

Am I missing something or is this feature is not (yet) implemented?

Thanks,
Fabio