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

ClientProxy doesn't resolve TypeVariables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.8.Final
    • 3.0.7.Final
    • jaxrs
    • None

      Example:

      Hello.java
      public interface Hello<T> {
      
      	   @POST
      	   @Path("/hello")
      	   @Produces("text/plain")
      	   @Consumes("text/plain")
      	   String sayHi(T in);
      }
      
      HelloString.java
      @Path(value = "/say")
      public interface HelloString extends Hello<String> {
      
      }
      

      The following code

      ResteasyClient client = new ResteasyClientBuilder().build();
      		   ResteasyWebTarget target = client.target("http://localhost:9095");
      		   HelloString proxy = target.proxy(HelloString.class);
      		   String hello = proxy.sayHi("hello");
      

      results in

      java.lang.IllegalArgumentException: The type is incompatible with the class of the entity.
      	at javax.ws.rs.core.GenericEntity.checkTypeCompatibility(GenericEntity.java:173)
      	at javax.ws.rs.core.GenericEntity.<init>(GenericEntity.java:152)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.processors.invocation.MessageBodyParameterProcessor.process(MessageBodyParameterProcessor.java:35)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.createRequest(ClientInvoker.java:135)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:101)
      	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:62)
      

            patriot1burke@gmail.com Bill Burke (Inactive)
            atzoum_jira Aris Tzoumas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: