users@jersey.java.net

Re: [Jersey] Re: Generated WADL response elements missing "element" attribute

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Wed, 27 Aug 2008 00:12:03 +0200

Hi,

On Fri, 2008-08-22 at 09:48 +0200, Paul Sandoz wrote:
> Hi Tim,
>
>
> Yes, you are correct in some cases information can be inferred for a
> 200 status code from the method signature. However, not in call cases,
> for example if a Response instance was returned, or more than one
> representation is possible to be returned.
So we could improve it like this:

If @Produces has exactly one value (e.g. "application/xml") we regard
this to be the mediaType for the representation for status 200 which
then overrides "@response.representation.200.mediaType" (the user does
not have to specify this).

If the resource method returns a Response, the user still migth declare
@Produces( "application/xml" ) but return some "text/plain" for e.g.
status 400.

Therefore we only should use the value of @Produces only for the status
200 representation. If the user specifies some javadoc tags referring to
the representation for status 400 he would still have to specify the
mediaType.

What do you think?


Regarding the element/qname topic (@response.representation.200.qname
{http://www.example.com}item): I don't see how this can be inferred from
the jaxb-bindings. Can you give me a pointer how we could extract this
information, Tim?

Cheers,
Martin


>
>
> Paul.
>
> On Aug 21, 2008, at 11:05 PM, Tim McCune wrote:
>
> > On 21 Aug 2008 20:51:17 -0000, users-digest-help_at_jersey.dev.java.net
> > <users-digest-help_at_jersey.dev.java.net> wrote:
> > From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
> > To: users_at_jersey.dev.java.net
> > Date: Thu, 21 Aug 2008 09:49:07 +0200
> > Subject: Re: [Jersey] Generated WADL response elements
> > missing "element" attribute
> > Hi Tim,
> >
> > Martin has recently done some work on improving WADL
> > integration with JAXB. I am sure he would know, but he is
> > away on holiday at the moment. I need to familiarize myself
> > with the exact details to understand if this is possible,
> > and if so, how it is enabled.
> >
> > There is an sample in the source code (see
> > samples/generate-wadl) that presents what can be done. If
> > you look at the source code for the resource classes you
> > will notice additional java doc elements.
> >
> > Paul.
> >
> > Thanks Paul. I took a look at the sample code, but I'm a bit
> > confused. For instance, I see this:
> > @response.representation.200.qname {http://www.example.com}item
> > @response.representation.200.mediaType application/xml
> >
> > The 2nd one seems like it duplicates the
> > @Produces({ "application/xml" })
> > annotation just below it, and the 1st one should be able to be
> > inferred from the JAXB bindings on the return type, right?
>