[Jersey] GenericType and proxy issue

From: Cem Koc <>
Date: Tue, 12 Apr 2011 03:21:10 -0700 (PDT)


I would like to create a proxy client implementation in order to create
client code of the the resource at runtime on the fly. In my projects I
observed that client codes of the projects are pretty same. However the cost
of the sync of the client codes and resource codes are very expensive for

I prefer proxy client codes over static client codes. In order to provide
this, I use interface as resource and the created proxy and restful web
services are based on this interface. In this way I can provide a contract
between my client code and restful web services.

However I have a pretty difficult situtation now regarding type erasure.

I have such a resource

      public List postSchool(String entity) {
         ArrayList l = generateData();
         return l;

I mean without static compilation I would like to generate client code like

     Method method = getResourceMethod();
     WebResource r = client.resource(getUri().path("test/list").build());
     ClientResponse cr =, "POST");
    // this is working as I expected
    // cr.getEntity(String.class)

At this point I would like to create entity, in this case "List". How I
would do this? Note that I have just method information at that point.

What trick should I use to get this information?


View this message in context:
Sent from the Jersey mailing list archive at