【发布时间】:2016-11-11 02:19:09
【问题描述】:
我创建了一个 REST Web 服务和一个客户端。客户端正在调用一个函数来获取所有播放列表。服务正在返回一个对象列表(播放列表)。如何将此响应保存在客户端上?
资源类:
@GET
public List<Playlist> getAllPlaylists(){
return playlistservice.getAllPlaylists();
}
服务类:
public List<Playlist> getAllPlaylists(){
return new ArrayList<Playlist>(playlists.values());
}
客户端代码(我在这里遇到错误)
List<Playlist> a = new ArrayList<Playlist>();
a = playlistsTarget
.request()
.get(List<Playlist>.class); // error here
如何将此响应保存到播放列表列表?
【问题讨论】:
-
请显示可理解的客户端代码和更多上下文
标签: java json rest web service