users@wadl.java.net

Re: SubResources and unique paths

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 17 Dec 2009 10:28:42 -0500

On Dec 17, 2009, at 7:03 AM, Sergey Beryozkin wrote:
>
> One of CXF users have tried to process the WADL generated by CXF with the wadl tools distribution available at the WADL dev site.
> This particulat WADL is generated from the JAX-RS resource containing multiple resources methods with same paths but different methods.
> At the WADL level one can do it like this :
>
> 1.
>
> <resource path="parent">
>
> <resource path="bar">
> <method name="GET">...</method>
> <method name="POST">...</method>
> </resource>
>
> </resource>
>
> CXF does this at the moment :
>
> 2.
>
> <resource path="parent">
>
> <resource path="bar">
> <method name="POST">...</method>
> </resource>
>
> <resource path="bar">
> <method name="GET">...</method>
> </resource>
>
> </resource>
>
> The user is reporting the following with 2 :
>
> Processing:
> file:/D:/notes/company%20related/applications/webservice/wadl-dist-1.0-SNAPSHOT/bin/accounts.wadl
> com.sun.codemodel.JClassAlreadyExistsException
> at com.sun.codemodel.JDefinedClass._class(JDefinedClass.java:654)
> at com.sun.codemodel.JDefinedClass._class(JDefinedClass.java:632)
> at
> org.jvnet.ws.wadl2java.ResourceClassGenerator.generateClass(ResourceClassGenerator.java:132)
> I think that even though 1 is more optimized, 2. is quite correct as well. The code generator could ve checked if the resource already exists and if yes then proceded with adding methods to it...
> I don't see the WADL spec requiring the uniqueness of (sub) resource paths...
>
> is 2. a valid WADL fragment. I'm going to do a fix for 1. be produced, but I'm just curious about the validity of 2.
>
Yes, 2 is a valid WADL fragment and wadl2java should handle this. Could you create an issue for it that includes the stack trace and attach an example WADL that illustrates the problem.

Thanks,
Marc.