users@wadl.java.net

Re: How to describe primitive representations

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 23 Feb 2010 10:39:13 -0500

On Feb 23, 2010, at 10:30 AM, Sergey Beryozkin wrote:

> Please see comments inline :
>
>> Hi,
>> Consider this JAXRS resource :
>> @Path("/")
>> public class Resource {
>> @GET
>> @Produces("text/plain")
>> public String getValue() {return "plain value";}
>> }
>> How to have such a plain representation described in WADL ?
>> Perhaps
>> <representation>
>> <param style="plain"/>
>> </representation>
>> ?
>
> There's no real structure in the response so I'd expect something like:
>
> <response status="200">
> <representation mediaType="text/plain"/>
> </response>
>
> S.B : what if we have
> @Path("/")
> public class Resource {
> @PUT
> @Consumes("text/plain")
> @Path("id")
> public void setValue(@PathParam("id") long id, @QueryParam("somequery") int queryValue, Long value) {}
> }
>
> PathParam and QueryParam will be seen as method parameters with 'type' attribute such as "xs:long", etc. It does seem like
> plain text representations could have had some optional type information captured too, thus I was thinking about :
>
> <representation mediaType="text/plain">
> <param style="plain" type="xs:long"/>
> </representation>
>
Yes, I guess that would work.

> or may be even better :
>
> <resource>
> <param type="xs:long" style="path" name="id"/>
> <method name="PUT">
> <request>
> <param type="xs:int" style="query">
> <param type="xs:long" style="plain">
> <!-- no representation element
> -->
> </request>
> </method>
> </resource>
>
I don't really like this one, the representation element is there to indicate that an entity body is expected and I don't think the overloading of style="plain" buys you much except a few saved characters in the description.

Marc.