users@wadl.java.net

SubResources and unique paths

From: Sergey Beryozkin <sberyozk_at_progress.com>
Date: Thu, 17 Dec 2009 12:03:35 -0000

Hi,

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.

thanks, Sergey