users@jersey.java.net

RE: [Jersey] Re: wadl->html worked...

From: Rabick, Mark A (IS) <"Rabick,>
Date: Mon, 18 May 2009 10:09:37 -0500

If you want to store the title in an external file, see the generate-wadl and extended-wadl-webapp samples as well as this article on the wiki:

http://wikis.sun.com/display/Jersey/HowToConfigureExtendedWADL

You can store introductory text and the title in an external file ie. Application-doc.xml with embedded <doc> elements and a title attribute:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<applicationDocs targetNamespace="http://research.sun.com/wadl/2006/10">
    
    <doc xml:lang="en" title="CNODB ReST API (WADL)">
        This document describes the available resources and data input/output formats available
        in the CNODB ReSTful web services application.
        </doc>
</applicationDocs>

The WADL generator configuration will need to include this file property:

/**
 * This class is used to define extensions to the default WADL generator
 * by defining properties in a wadl generation configuration class.
 * The following wadl enhancements are incorporated:
 * <ul>
 * <li>An introductory paragraph for the application using a {_at_link WadlGeneratorApplicationDoc}
 * generator with a reference to the <i>application-doc.xml</i> file.</li>
 * <li>An XSD schema from a {_at_link WadlGeneratorGrammarsSupport} generator stored in the file
 * <i>application-grammars.xml</i> file.</li>
 * <li>Incorporate javadoc elements in a generated <i>resourcedoc.xml</i> file
 * using a {_at_link WadlGeneratorResourceDocSupport} generator. The file must
 * be generated before packaging the application. The file is generated using
 * javadoc defined in the build file.
 * </ul>
 */
public class CnodbRestWadlGeneratorConfig extends WadlGeneratorConfig {

        /**
         * This is an override of the Jersey superclass method that configures the
         * WADL generator for runtime enhancements of the application generated WADL.
         * @return The List of WADL generator descriptions
         *
         * @see com.sun.jersey.api.wadl.config.WadlGeneratorConfig#configure()
         */
        @Override
        public List<WadlGeneratorDescription> configure() {
                
        return generator( WadlGeneratorApplicationDoc.class )
                        .prop( "applicationDocsStream", "application-doc.xml" )
                        .generator( WadlGeneratorGrammarsSupport.class )
                        .prop( "grammarsStream", "application-grammars.xml" )
                        .generator( WadlGeneratorResourceDocSupport.class )
                        .prop( "resourceDocStream", "resourcedoc.xml" )
                        .descriptions();


        }

}

Finally, you'll need to configure your WADL generator in the web.xml servlet configuration:

        <init-param>
            <param-name>com.sun.jersey.config.property.WadlGeneratorConfig</param-name>
            <param-value>mil.cnodb.rs.config.CnodbRestWadlGeneratorConfig</param-value>
        </init-param>

See the samples for how to generate the resourcedoc.xml which reads the extended javadoc annotations in your source code:

http://wikis.sun.com/display/Jersey/SupportedJavadocTagsForExtendedWADL

--mark

_______________________________________________
Mark A. Rabick - Software Engineer
Em: mark.rabick_at_ngc.com

 

> -----Original Message-----
> From: Felipe Gaúcho [mailto:fgaucho_at_gmail.com]
> Sent: Saturday, May 16, 2009 8:07 AM
> To: users_at_jersey.dev.java.net
> Subject: [Jersey] Re: wadl->html worked...
>
> application.getDoc().get(0).setTitle("Footprint Service API");
>
> :)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>