users@jersey.java.net

Re: [Jersey] WADL Generation

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Mon, 09 Feb 2009 01:38:12 +0100

Hi Fabio,

sounds desirable to have that, this is just not yet implemented.

I entered an issue for that ([1]).

@Paul: the request/response representations for wadl are determined via
AbstractResourceMethod.getSupportedInputTypes/getSupportedOutputTypes.
I'd say the change should be local to WADL generation and not affect
these methods of AbstractResourceMethod. Just want to double check that
with you.

@Paul: I think the solution should basically be this:
- get MessageBodyReader/Writer provider classes from the ResourceConfig
that read/write the input/output type of the resource method (determined
via the type parameter of the MBR/MBW class)
- read the @Produces/_at_Consumes from the MBR/MBW and also regard these as
supported input/output types

OK?

Cheers,
Martin


[1] https://jersey.dev.java.net/issues/show_bug.cgi?id=205





On Sun, 2009-02-08 at 20:05 +0100, Fabio Mancinelli wrote:
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net

-- 
Martin Grotzke
http://www.javakaffee.de/blog/