
Here is an example of documented JAX-RS and JAXB code:
Figure 1.1. Example of documented JAX-RS and JAXB code
package com.lunatech.doclets.jax.test; import javax.ws.rs.*; import javax.xml.bind.annotation.*; /** * An example JAX-RS resource */ @Path("/example") @Produces( { "application/xml", "application/*+xml" }) public class JAXRSExample { /** * An example resource */ @XmlRootElement public static class JAXBExample { /** * The resource ID */ @XmlID @XmlElement String id; /** * The example contents */ @XmlValue String contents; /** * An optional attribute */ @XmlAttribute String type; } /** * Gets an example resource * * @param id * the example id * @param type * the type of resource we prefer * @param startIndex * the start index * @return an example resource suitable for the given parameters * @HTTP 404 if there is no such example resource * @RequestHeader X-Example-Auth the authentication header * @ResponseHeader Location a pointer to the example details */ @Path("{id}") @GET public JAXBExample getExample(@PathParam("id") String id, @MatrixParam("type") String type, @QueryParam("start") int startIndex) { return new JAXBExample(); } }