jersey客户端返回List的两种方式

jersey客户端返回List的两种方式:

前提是服务端的rest实现需要返回list对象

1) Using array: 

     Client c = ... 
     Token[] ts = c.resource(...).path(...).get(Token[].class); 

2) Using the the class com.sun.jersey.api.client.GenericType to ensure   
that 
      generic type information is retained: 

     List<Token>[] ts = c.resource(...).path(...).get(new   
GenericType<List<Token>>() {});

posted on 2013-01-03 10:02  yoyo002  阅读(1105)  评论(0编辑  收藏  举报