users@jersey.java.net

Re: [Jersey] Re: Generate WADL on runtime

From: António Mota <amsmota_at_gmail.com>
Date: Mon, 13 Jul 2009 12:39:22 +0100

Paul Sandoz wrote:
>
> On Jul 13, 2009, at 12:43 PM, António Mota wrote:
>
>> Hi again.
>>
>> Finally, I'm trying to generate my Wadl using pieces and bits of
>> Jersey, basically like this:
>>
>> WadlBuilder builder = new WadlBuilder(new WadlGeneratorImpl());
>> Application application = builder.generate(abstractResource);
>>
>> Then I just serialize this "application" object using XStream.
>
> You need to use JAXB to marshall out an instance of Application as a
> WADL document.
>
Well, yes, but since we are not using Jaxb for the reasons I've told,
and we are not using the full stack of Jersey, I'm using XStream to
serialize the Application object. Basically I just introspect all the
classes that I found in com.sun.research.ws.wadl and use the annotation
XmlRootElement value as the alias for XStream. That part is working OK.

Now the OPTIONS is just that method I choosed to invoke my code, it has
nothing specific as the same code was being invoked with a GET with
application/vnd.sun.wadl+xml as well.

And if I debug the application object, I do see that there is a

application.doc[ArrayList].Doc

application.resoures.resource[ArrayList].Resource

So should I assume that the JAXB Marshaling is getting read of some of
the fields? Besides the XmlRootElement are there other annotations for
the Marshaling?

Thanks for your help.