wadl
  1. wadl
  2. WADL-41

Duplicate methods generated when return type of method is void

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I was testing the following service:

      @Path("/put")
      public class PutResource {
      @GET
      @Produces("application/xml")
      public Bean get()

      { return new Bean(); }

      @PUT
      @Consumes("application/xml")
      public void put(Bean bean) {

      }
      }

      And I forgot to turn on XML Schema generation and I went to generate a client and it came up with code that has duplicate methods and doesn't actually invoke the service in question. Possibly two issues here.

      package example;

      import java.util.HashMap;
      import javax.annotation.Generated;
      import javax.ws.rs.core.UriBuilder;
      import com.sun.jersey.api.client.Client;
      import com.sun.jersey.api.client.WebResource;

      /**

      • */
        @Generated(value = "http://localhost:7201/Project1/jersey/application.wadl", comments = "wadl2java")
        public class HttpLocalhost7201Project1Jersey {

      public static class Put {

      private Client _client;
      private UriBuilder _uriBuilder;
      private HashMap<String, Object> _templateAndMatrixParameterValues;

      /**

      • Create new instance using existing Client instance
      • */
        public Put(Client client)

        { _client = client; _uriBuilder = UriBuilder.fromPath("http://localhost:7201/Project1/jersey/"); _uriBuilder = _uriBuilder.path("/put"); _templateAndMatrixParameterValues = new HashMap<String, Object>(); }

      /**

      • Create new instance
      • */
        public Put()

        { this(Client.create()); }

      public void getAsvoid()

      { UriBuilder localUriBuilder = _uriBuilder.clone(); WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues)); WebResource.Builder resourceBuilder = resource.getRequestBuilder(); return ; }

      public void get() { UriBuilder localUriBuilder = _uriBuilder.clone(); WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues)); WebResource.Builder resourceBuilder = resource.getRequestBuilder(); return ; }

      public void get()

      { UriBuilder localUriBuilder = _uriBuilder.clone(); WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues)); WebResource.Builder resourceBuilder = resource.getRequestBuilder(); return ; }

      public void putApplicationXmlApplicationXml(Object input)

      { UriBuilder localUriBuilder = _uriBuilder.clone(); WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues)); WebResource.Builder resourceBuilder = resource.getRequestBuilder(); resourceBuilder = resourceBuilder.type("application/xml"); return ; }

      public void putApplicationXmlApplicationXml(Object input) { UriBuilder localUriBuilder = _uriBuilder.clone(); WebResource resource = _client.resource(localUriBuilder.buildFromMap(_templateAndMatrixParameterValues)); WebResource.Builder resourceBuilder = resource.getRequestBuilder(); resourceBuilder = resourceBuilder.type("application/xml"); return ; }

      }
      }

        Activity

        Hide
        gdavison added a comment -

        The WADL for this case is:

        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <application xmlns="http://research.sun.com/wadl/2006/10">
        <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.8-SNAPSHOT 06/01/2011 07:09 PM"/>
        <resources base="http://localhost:7201/Project1/jersey/">
        <resource path="/put">
        <method id="get" name="GET">
        <response>
        <representation mediaType="application/xml"/>
        </response>
        </method>
        <method id="put" name="PUT">
        <request>
        <representation mediaType="application/xml"/>
        </request>
        </method>
        </resource>
        </resources>
        </application>

        Show
        gdavison added a comment - The WADL for this case is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <application xmlns="http://research.sun.com/wadl/2006/10"> <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.8-SNAPSHOT 06/01/2011 07:09 PM"/> <resources base="http://localhost:7201/Project1/jersey/"> <resource path="/put"> <method id="get" name="GET"> <response> <representation mediaType="application/xml"/> </response> </method> <method id="put" name="PUT"> <request> <representation mediaType="application/xml"/> </request> </method> </resource> </resources> </application>
        Hide
        gdavison added a comment -

        Proposed patch

        Show
        gdavison added a comment - Proposed patch
        Hide
        gdavison added a comment -

        Revision 305

        Show
        gdavison added a comment - Revision 305

          People

          • Assignee:
            gdavison
            Reporter:
            gdavison
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours
              2h