jeudi 10 novembre 2016

How to handle that json response in java?

I have created a rest web service and a client. Client is calling a function to get all playlists. Service is returning a List of objects(Playlist). How to save this response on a client?

Resource class:

@GET
public List<Playlist> getAllPlaylists(){
    return playlistservice.getAllPlaylists();
}

Service class:

    public List<Playlist> getAllPlaylists(){
    return new ArrayList<Playlist>(playlists.values());
}

Client code(im getting error here)

List<Playlist> a = new ArrayList<Playlist>();

                        a = playlistsTarget
                                .request()
                                .get(List<Playlist>.class); // error here

How to save this response to List of playlist?




Aucun commentaire:

Enregistrer un commentaire