users@wadl.java.net

Re: Converting JAX-RS resources to WADL

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 07 Jul 2009 11:26:20 -0400

On Jul 7, 2009, at 10:45 AM, Sergey Beryozkin wrote:
>
> thanks... Few more questions :
>
> 1. How to describe @Form parameters or MultivaluedMap parameters ?
>
> should it be just <representation mediaType="application/x-www-form-
> urlencoded"/> ?
>
For a MultivaluedMap param then the above is all the information you
can extract statically. For @Form params you can extract the type and
name of the param (and maybe a default value if specified) so you can
include child param elements inside the representation element:

<representation mediaType="application/x-www-form-urlencoded">
   <param name="..." style="query" type="..." default="..."/>
   ...
</representation>

> 2. Can arbitrary HTTP methods like PATCH/etc be accepted ?
>
Yes.

Marc.

>
> cheers, Sergey
>
>
>> On Jun 29, 2009, at 7:33 AM, Sergey Beryozkin wrote:
>>>
>>> I have few questions about converting JAX-RS resources to WADL.
>>>
>>> 1. How to represent recursive relationships ?
>>> For ex :
>>> @Path("/bar")
>>> public RootResource() {
>>>
>>> @GET
>>> public State get() {}
>>>
>>>
>>> @Path("/sub")
>>> public RootResource asSubresource() {
>>> return this;
>>> }
>>> }
>>>
>>> I was rthinking about something like :
>>> <application><resources>
>>> <resource id="root">
>>> <resource path="/bar">
>>> <method name="GET">...</method>
>>> </resource>
>>> <resource path="/bar/sub" idref="root"/>
>>> </resources></application>
>>>
>>> what is the right way to do it ?
>>>
>> The idref isn't a WADL attribute. In Jersey we support partial
>> WADLs so for subresource locators we just return an empty
>> <resource path="..."/> and then the client can GET the partial
>> WADL for the subpath later. I covered this in a blog entry:
>> http://weblogs.java.net/blog/mhadley/archive/2007/12/wadling_in_jers.html
>>> 2. Multiple consumes/produces types on a given method :
>>>
>>> @GET Produces("application/xml, application/json") public State
>>> get() {}
>>>
>>> does it translate to two GET methods with the one representation
>>> element in each one or a single GET element with 2
>>> representations elements ?
>>>
>> Either is valid but the canonical way is one get method with two
>> sibling representations.
>> Marc.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_wadl.dev.java.net
>> For additional commands, e-mail: users-help_at_wadl.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_wadl.dev.java.net
> For additional commands, e-mail: users-help_at_wadl.dev.java.net
>