+ -
当前位置:首页 → 问答吧 → 关于RESTEasy实现客户端与服务端接口共享问题

关于RESTEasy实现客户端与服务端接口共享问题

时间:2011-04-01

来源:互联网

如题。这是我在jboss官网上看到的共享接口例子:
服务端接口:
@Path("/")
public interface MyInterface {

  @GET
  @Produces("application/xml")
  public Response getMyListOfJAXBObjects();
}

客户端调用:
MyInterface proxy = ProxyFactory.create(MyInterface.class, "http://localhost:8081");
ClientResponse response = (ClientResponse)proxy.getMyListOfJAXBObjects();
List<MyJaxbClass> list = response.getEntity(new GenericType<List<MyJaxbClass>>());

我本地测试这些代码的时候,GenericType这里总是报错构造不可见。我查了一下API说是GenericType类是受保护的。有没有开发过的朋友指点一下?或者给个例子

作者: jiaxun2008   发布时间: 2011-04-01