Generate WADL Example

The example shows, how to generate a customized WADL for you application

How to run the example

Generate the application.wadl

Build the project, generate the resourcedoc.xml with javadoc and generate the wadl file:

$ mvn compile javadoc:javadoc com.sun.jersey.contribs:maven-wadl-plugin:generate

Afterwards have a look at the target/classes/application.wadl and at these artifacts:

pom.xml
How all this wadl generation stuff is configured
src/main/java/com/sun/jersey/samples/generatewadl/resources/ItemsResource.java
Shows how custom javadoc tags can be used to extend the generated wadl documentation
src/main/java/com/sun/jersey/samples/generatewadl/util/ExampleDocProcessor.java
Shows how you can process your custom tags and add them to the generated resourcedoc.xml. An "@example.tag" can be found at ItemsResource.createItem
src/main/java/com/sun/jersey/samples/generatewadl/util/ExampleWadlGenerator
Shows how the custom information added by the ExampleDocProcessor to the resourcedoc.xml can be processed by this WadlGenerator and used to extend the generated application.wadl

Generate a complete application.html

If you're on unix and have xsltproc installed you can simply run mvn package

$ mvn package

and afterwards have a look at the generated target/application.html

Start jersey with the ItemsResource

If you want to start jersey with the resource classes of this application so that you can add, read and update items just run mvn exec:java:

$ mvn exec:java
The customized WADL should be available at http://localhost:9998/application.wadl

A new item could be added by issuing the following command using curl

curl -X POST --data '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><item xmlns="http://www.example.com">foo</item>' -H Content-Type:application/xml -i http://localhost:9998/items