users@jersey.java.net

Re: [Jersey] WADL and resource wide params

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Mon, 09 Feb 2009 02:34:59 +0100

On Thu, 2009-02-05 at 03:20 +0100, Martin Grotzke wrote:
> Hi Andrew,
>
> the trick is to use the param in some resource method:
>
> @Singleton
> @Path("/devices/{guid}")
> public class DevicesResource {
> @GET
> public String echo( @PathParam( "guid" ) String guid ) {
> return guid;
> }
> }
>
> Without this, it doesn't show up in the wadl. Right now, the wadl param
> element attached to the resource is the wadl param that was found as
> param in some method.
>
> Therefore, it's enough for you to java-document the method param to get
> the wadl param documented.
>
> To be able to supply a resource wide param documentation like what I
> suggested (e.g. @pathparam.guid in your case, on class level) the code
> building the wadl would have to be refactored. This would also be
> required to have better support for resource params, e.g. when they are
> used as class fields - AFAICS those would get dropped now (that's why I
> couldn't produce the wadl param at first, I just used the path param as
> a field withing the resource class).
>
> I'll enter an issue for this (the next days).
Done ([1]).

Regarding the documentation of resource params (used in resource class
fields or resource class bean properties) I think we don't need any
custom javadoc (like @pathparam.guid) on the resource class as we have
the javadoc of the resource class field or bean property and should use
that.

Cheers,
Martin


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


>
> However, you should have a solution for now - at least I hope so :)
>
> Cheers,
> Martin
>
>
> On Wed, 2009-02-04 at 10:58 -0700, Andrew Ochsner wrote:
> > So, I'm using 1.0.1 right now...not sure if that matters...
> >
> > Have a class that looks similar to this:
> > @Path("devices/{guid}")
> > @Service
> > @Produces({ MediaType.APPLICATION_JSON })
> > @Consumes({ MediaType.APPLICATION_JSON })
> > public class DevicesResource {}...
> >
> >
> > And wadl section like this:
> > <ns2:resource
> > path="devices/{guid}"><ns2:doc><![CDATA[Comments
> > here]]></ns2:doc><ns2:param
> > type="xs:string" style="template" name="guid"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"/>....
> >
> > I'm using just the ResourceDoclet and WadlGeneratorResourceDocSupport.
> > See this behavior both when generating wadl at build time using my Ant
> > task as well as when generated at runtime
> >
> >
> > On Tue, Feb 3, 2009 at 9:46 PM, Martin Grotzke
> > <martin.grotzke_at_freiheit.com> wrote:
> > Hi Andrew,
> >
> > I just wanted implement the support for documentation of
> > resource wide
> > path params.
> >
> > However, when I set the @Path annotation on the resource class
> > to s.th.
> > like "/items/{someparam}" I don't see a param element for this
> > resource
> > in the generated wadl.
> >
> > Can you post your resource class?
> > How are you generating the wadl file?
> >
> > Cheers,
> > Martin
> >
> >
> >
> > On Tue, 2009-02-03 at 11:26 -0700, Andrew Ochsner wrote:
> >
> >
> > > So I have a resource whose path is
> > @Path(/resource/{selector}) When
> > > i generate wadl, it does insert a resource wide param
> > element. Is
> > > there any way (via javadoc or some other) to add a
> > description to that
> > > resource wide parameter?
> > >
> > > Andy o
> >

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