Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1955

MicroprofileClientBuilder can't handle nested @BeanParam's

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.0.0.CR1, 3.7.0.Final
    • 3.6.0.Final, 3.6.2.Final
    • jaxrs
    • None

    Description

      MicroprofileClientBuilder can't handle nested BeanParam(s).

      Example
      Deployment:

      public class Params {
          @PathParam("p1")
          private String p1;
          public String getP1() {
              return p1;
          }
          public void setP1(String p1) {
              this.p1 = p1;
          }
      }
      @Path("/a")
      public interface Proxy {
          @GET
          @Path("a/{p1}")
          String getAll(@BeanParam Params beanParam);
      }
      @Path("/a")
      public class Resource {
          @GET
          @Path("a/{p1}")
          public String getAll(@BeanParam Params beanParam) {
              return beanParam.getP1() + "_" + beanParam.getP1();
          }
      }
      

      Client:

      public class App {
          private static ResteasyClient client = new ResteasyClientBuilder().build();
          public static void main(String[] args) throws Exception {
              Params params = new Params();
              params.setP1("test");
      
              // normal client usage works as expected
              Response r = client.target("http://localhost:8080/jaxrs-wf/a/a/test").request().get();
              System.out.println(r.readEntity(String.class));
      
              // proxy client usage works as expected
              Proxy apiService = client.target("http://localhost:8080/jaxrs-wf/").proxy(Proxy.class);
              System.out.println(apiService.getAll(params));
      
              // MP rest client fails
              RestClientBuilder builder = RestClientBuilder.newBuilder();
              Proxy restClient = builder.baseUrl(new URL("http://localhost:8080/jaxrs-wf/")).build(Proxy.class);
              System.out.println(restClient.getAll(params));
          }
      }
      

      This causes a RestClientDefinitionException when starting the RestClientBuilder:

      Exception in thread "main" org.eclipse.microprofile.rest.client.RestClientDefinitionException: Parameters and variables don't match on interface com.resteasy.test.Proxy::getAll
      	at org.jboss.resteasy.client.microprofile.MicroprofileClientBuilder.verifyInterface(MicroprofileClientBuilder.java:215)
      	at org.jboss.resteasy.client.microprofile.MicroprofileClientBuilder.build(MicroprofileClientBuilder.java:85)
      	at com.resteasy.test.App.main(App.java:33)
      

      Proxy client works correctly, this issue is valid just for MP rest client (cc asoldano)

      Attachments

        Activity

          People

            mmarusic Marek Marusic (Inactive)
            ms_s75 M Schmitt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: