You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Matt Silver <ma...@webagesolutions.com> on 2012/10/19 17:18:49 UTC
Re: Generating WADL with schema import and "element" attribute on representation
Bryant/Roberto,
Were either of you able to generate a WADL which includes the schema (i.e.,
grammar and element elements)? I'm using WAS 8, which includes Apache Wink.
What I'm wondering is what specific JAXB annotations do I need to add to my
classes for the above elements to be added to my WADL file? Currently, I'm
just annotating the class with @XmlRootElement.
e.g.,
@XmlRootElement(name="order")
public class Order {
long orderId;
String clientId;
double orderTotal;
String status;
String expectedShipDate;
// getters and setters
}
Am I instead supposed to be annotating a subclass of the
org.apache.wink.common.model.wadl.Application class, which I then configure
in the web.xml?
IBM provides the following documentation on how to create a method to
customize the WADL generation, but doesn't show any examples of how to do
customization:
@javax.ws.rs.Path("myexample")
public class MyResource {
@Context
javax.ws.rs.core.Application app;
@javax.ws.rs.OPTIONS
@Produces("application/vnd.sun.wadl+xml")
public org.apache.wink.common.model.wadl.Application getOptions() {
org.apache.wink.common.model.wadl.Application wadlAppDoc = new
WADLGenerator().generate("", app.getClasses());
/* modify the wadlAppDoc JAXB model if you want to add additional
information */
return wadlAppDoc;
}
}
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/topic/com.ibm.websphere.base.
iseries.doc/info/iseries/ae/twbs_jaxrs_wadl_serving.html
Thanks in advance,
Matt
From
Bryant Luk <br...@gmail.com>
Subject
Re: Generating WADL with schema import and "element" attribute on
representation
Date
Mon, 24 Jan 2011 21:08:43 GMT
There isn't a way to do this currently. Right now you have to manually
manipulate the jaxb
objects. However if someone would like to contribute a patch I think this
would be useful.
On Jan 24, 2011, at 1:12 PM, Cappa Roberto
<ro...@guest.telecomitalia.it> wrote:
> Hi,
>
> is there a way to generate a WADL with WADLGenerator that includes xml
schema import
in "grammar" section? After this, I would like to set the "element"
attribute on xml "representation".
Is there a way to do this automatically, based on annotations on java
databinding classes?
>
> Thanks.
Sincerely,
Matthew Silver
Web Age Solutions Inc.
WebSphere and WebLogic Training and Consulting Services
<http://www.webagesolutions.com/> Web | <http://blog.webagesolutions.com/>
Blog | <http://www.facebook.com/WebAgeSolutions> Facebook |
<http://www.linkedin.com/groups/Web-Age-Solutions-3282557?mostPopular=&gid=3
282557> Linked In
Email: matt.silver@webagesolutions.com
Cell: (954) 654-9623
Phone: (954) 977-0117