users@jersey.java.net

Re: [Jersey] wadl generation

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 06 May 2008 17:59:03 -0700

I think what you want would be possible with some additional
development in Jersey but there's no way to do it right now.

Marc.

On May 5, 2008, at 11:32 AM, Dave Tkaczyk wrote:

> Hi,
>
> I have an annotated resource that looks like this:
>
> @POST
> @ProduceMime("application/xml")
> @ConsumeMime("application/xml")
> @Path("/{externalDeviceIdentifierNamespace}")
> public Response
> addNewDeviceToNamespace
> (@PathParam("externalDeviceIdentifierNamespace") String
> externalDeviceIdentifierNamespace,
> @Context UriInfo uriInfo,
> Device device) {
>
> I’m using the WadlGeneratorTask ant task and it produces this:
>
> <resource path="/{externalDeviceIdentifierNamespace}">
> <param xmlns:xs="http://www.w3.org/2001/XMLSchema"
> type="xs:string" style="template"
> name="externalDeviceIdentifierNamespace" />
> <method name="POST">
> <request>
> <representation mediaType="application/xml" />
> </request>
> <response>
> <representation mediaType="application/xml" />
> </response>
> </method>
> </resource>
>
> The “Device” representation is being supplied on the request and
> also returned on the response. Is there a way to get the generated
> WADL representation to show details about the Device elements and
> attributes? Are there any attributes on the ant task or annotations
> that I’m failing to use on the java Device class? I will include
> the class here as well – please see below.
>
> Thanks,
> Dave
>
>
> package com.pangonetworks.service.rs._2008_04_25;
>
> import javax.xml.bind.annotation.XmlAttribute;
> import javax.xml.bind.annotation.XmlElement;
> import javax.xml.bind.annotation.XmlRootElement;
>
> /**
> * Device annotated object.
> *
> * @author Copyright (c) 2008 by Innerwireless, Inc. All Rights
> Reserved.
> */
> @XmlRootElement(name="device")
> public class Device {
>
> /**
> * Device states.
> */
> @XmlElement(name="device-states", required=false)
> private States states;
>
> /**
> * Geo location of device.
> */
> @XmlElement(name="geo-location", required=false)
> private GeoLocation geoLoc;
>
> /**
> * Reporting profile name.
> */
> @XmlElement(name="report-profile-name", required=false)
> private String tagReportProfileName;
>
> /**
> * Security profile name.
> */
> @XmlElement(name="security-profile-name", required=false)
> private String tagSecurityProfileName;
>
> /**
> * Device type.
> */
> @XmlElement(name="device-type", required=true)
> private DeviceType deviceType;
>
> /**
> * HREF to GET device with.
> */
> @XmlAttribute(name="href", required=false)
> private String href;
>
> /**
> * Device external identifier.
> */
> @XmlAttribute(name="external-identifier", required=true)
> private String deviceExternalIdentifier;
>
> /**
> * Device external identifier namespace.
> */
> @XmlAttribute(name="external-identifier-namespace", required=true)
> private String deviceExternalIdentifierNamespace;
>
> /**
> * Constructs new device.
> */
> public Device() {
> }
>
> /**
> * Constructs new device.
> *
> * @param deviceExternalIdentifierNamespace device namespace
> * @param deviceExternalIdentifier device identifier
> * @param deviceType device type
> * @param tagReportProfileName reporting profile name
> * @param tagSecurityProfileName security profile name
> * @param href GET href
> * @param geoLocation geo-location of devicee
> * @param states device states
> */
> public Device(String deviceExternalIdentifierNamespace,
> String deviceExternalIdentifier,
> DeviceType deviceType,
> String tagReportProfileName,
> String tagSecurityProfileName,
> String href,
> GeoLocation geoLocation,
> States states) {
> this.deviceExternalIdentifierNamespace =
> deviceExternalIdentifierNamespace;
> this.deviceExternalIdentifier = deviceExternalIdentifier;
> this.deviceType = deviceType;
> this.tagReportProfileName = tagReportProfileName;
> this.tagSecurityProfileName = tagSecurityProfileName;
> this.href = href;
> this.geoLoc = geoLocation;
> this.states = states;
> }
>
> /**
> * Gets the device type.
> *
> * @return the deviceType
> */
> public DeviceType getDeviceType() {
> return deviceType;
> }
>
> /**
> * Gets the reporting profile name.
> *
> * @return the tagReportProfileName
> */
> public String getTagReportProfileName() {
> return tagReportProfileName;
> }
>
> /**
> * Gets the security profile name.
> *
> * @return the tagSecurityProfileName
> */
> public String getTagSecurityProfileName() {
> return tagSecurityProfileName;
> }
>
> /**
> * Gets the device external identifier.
> *
> * @return the deviceExternalIdentifier
> */
> public String getDeviceExternalIdentifier() {
> return deviceExternalIdentifier;
> }
>
> /**
> * Gets the device external identifier namespace.
> *
> * @return the deviceExternalIdentifierNamespace
> */
> public String getDeviceExternalIdentifierNamespace() {
> return deviceExternalIdentifierNamespace;
> }
>
> /**
> * Gets the HREF to get the device with.
> *
> * @return the href
> */
> public String getHref() {
> return href;
> }
>
> /**
> * Gets the geo-location of the device.
> *
> * @return the geoLoc
> */
> public GeoLocation getGeoLoc() {
> return geoLoc;
> }
>
> /**
> * Gets all the state for the device.
> *
> * @return the states
> */
> public States getStates() {
> return states;
> }
>
> }
>
>
>
>
>
>
> Confidentiality Notice: This email message is covered by the
> Electronic Communications Privacy Act, 18 U.S.C. §2510-2521 and is
> legally privileged. Unauthorized review, use, disclosure or
> distribution is strictly prohibited. If you are not the intended
> recipient, please contact Dave.Tkaczyk_at_innerwireless.com and destroy
> all copies of the original message. Thank you.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.