ExtendedWadlExample

This is an example for an extended version of a generated WADL, this is what's generated for the generate-wadl sample.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:application xmlns:ns2="http://research.sun.com/wadl/2006/10">
    <ns2:doc xmlns:jersey="http://jersey.dev.java.net/" jersey:generatedBy="Jersey: 0.10-ea-SNAPSHOT 08/27/2008 08:24 PM"/>
    <ns2:doc xml:lang="en" title="The doc for your API">
        This is a paragraph that is added to the start of the generated application.wadl
    </ns2:doc>
    <ns2:doc xml:lang="de" title="Die Dokumentation fuer Ihre API">
        Dies in ein Abschnitt, der dem Beginn der generierte application.wadl hinzugefügt wird - in deutscher Sprache.
    </ns2:doc>
    <ns2:grammars>
        <ns2:include href="schema.xsd"/>
    </ns2:grammars>
    <ns2:resources base="http://localhost.localdomain.tld:9998/">
        <ns2:resource path="items">
            <ns2:doc>This is the root resource for managing items.&lt;br /&gt;
 Created on: Jul 20, 2008&lt;br /&gt;</ns2:doc>
            <ns2:method name="POST" id="createItem">
                <ns2:doc>Add a new item to the list of managed items. The item will get assigned an id,
 the resource where the item is available will be returned in the location header.</ns2:doc>
                <ns2:request>
                    <ns2:representation xmlns:ns3="http://www.example.com" mediaType="application/xml" element="ns3:item">
                        <ns2:doc>
                            <ns4:p xmlns:ns4="http://www.w3.org/1999/xhtml">
<ns4:h6>Example</ns4:h6>
<ns4:pre>
    <ns4:code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;item xmlns=&quot;http://www.example.com&quot;&gt;foo&lt;/item&gt;
</ns4:code>
</ns4:pre>
                            </ns4:p>
                        </ns2:doc>
                    </ns2:representation>
                </ns2:request>
                <ns2:response>
                    <ns2:doc>The response with the status code and the location header.</ns2:doc>
                    <ns2:param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:anyURI" style="header" name="Location">
                        <ns2:doc>The URI where the created item is accessable.</ns2:doc>
                    </ns2:param>
                    <ns2:representation mediaType="*/*"/>
                </ns2:response>
            </ns2:method>
            <ns2:resource path="{id}">
                <ns2:doc>This resource is used to manage a single item.&lt;br /&gt;
 Created on: Jul 20, 2008&lt;br /&gt;</ns2:doc>
                <ns2:param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:int" style="template" name="id"/>
                <ns2:method name="GET" id="getItem">
                    <ns2:doc>Returns the item if existing.</ns2:doc>
                    <ns2:response>
                        <ns2:representation xmlns:ns3="http://www.example.com" mediaType="application/xml" status="200" element="ns3:item">
                            <ns2:doc>
<ns4:p xmlns:ns4="http://www.w3.org/1999/xhtml">
    <ns4:h6>Example</ns4:h6>
    <ns4:pre>
        <ns4:code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;item xmlns=&quot;http://www.example.com&quot;&gt;foo&lt;/item&gt;
</ns4:code>
    </ns4:pre>
</ns4:p>
                            </ns2:doc>
                        </ns2:representation>
                    </ns2:response>
                </ns2:method>
                <ns2:method name="GET" id="getItemAsJSON">
                    <ns2:doc>Returns the item if existing.</ns2:doc>
                    <ns2:response>
                        <ns2:representation mediaType="application/json" status="200">
                            <ns2:doc>
<ns3:p xmlns:ns3="http://www.w3.org/1999/xhtml">
    <ns3:h6>Example</ns3:h6>
    <ns3:pre>
        <ns3:code>[&quot;myValue&quot;]</ns3:code>
    </ns3:pre>
</ns3:p>
                            </ns2:doc>
                        </ns2:representation>
                    </ns2:response>
                </ns2:method>
                <ns2:resource path="value/{value}">
                    <ns2:param xmlns:xs="http://www.w3.org/2001/XMLSchema" type="xs:string" style="template" name="value">
                        <ns2:doc>the new value to set</ns2:doc>
                    </ns2:param>
                    <ns2:method name="PUT" id="updateItemValue">
                        <ns2:doc>Update the value property of the current item.</ns2:doc>
                    </ns2:method>
                </ns2:resource>
            </ns2:resource>
        </ns2:resource>
    </ns2:resources>
</ns2:application>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 09, 2008

    Alexandre.Morgaut says:

    Some comments about your doc elements of the application tag The specificatio...

    Some comments about your doc elements of the application tag

    • The specification says about it : "xml:lang Defines the language for the title attribute value and the contents of the doc element. If an element contains more than one doc element then they MUST have distinct values for their xml:lang attribute."
    • Thought I would suggest to put the "jersey:generatedBy" attribute directly into the application tag.
    • And just don't forget, even if it must only have been forgoten from a translation,  to set the appropriate value to xml:lang, as the doc is in english, it should be "en" and not "de" (german)
    1. Nov 10, 2008

      sandoz says:

      I thought about utilizing the application tag instead but the WADL schema does n...

      I thought about utilizing the application tag instead but the WADL schema does not declare wild card attributes and thus the JAXB application class is that automatically generated from the schema does not have the ability to add any attribute. But the doc tag does it was a lot easier in this respect to reuse that.

      Martin, who created the example, lives in Germany, but i agree it should be "en" in this case.

      Could you log an issue against this sample?

      https://jersey.dev.java.net/issues/

      Thanks,
      Paul.

    2. Feb 02, 2009

      martin.grotzke says:

      Hi Alexandre, (I didn't get notified by the wiki so that I had to notice this b...

      Hi Alexandre,

      (I didn't get notified by the wiki so that I had to notice this by incident )

      thanx for the hint concerning the doc elements and the xml:lang attribute - now I understand the purpose of this

      I changed the example on this page and also in the repository.

      Cheers,
      Martin

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact