users@jersey.java.net

[Jersey] GenericType and proxy issue

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

Hi,

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
me.

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

      @POST
      @Path("list")
      public List postSchool(String entity) {
         ArrayList l = generateData();
         return l;
      }



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

     Method method = getResourceMethod();
     WebResource r = client.resource(getUri().path("test/list").build());
     ClientResponse cr = r.post(ClientResponse.class, "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?

cr.getEntity(???????)


--
View this message in context: http://jersey.576304.n2.nabble.com/GenericType-and-proxy-issue-tp6264581p6264581.html
Sent from the Jersey mailing list archive at Nabble.com.