Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jersey 2 library response.getEntity not exist what should I use instead

Tags:

netbeans

my code

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import clients.NewJerseyClient;



import entities.ReservationItem;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.ws.rs.core.GenericType;

import parameters.ReservationParam;
import  org.glassfish.jersey.client.ClientResponse;

/**
 *
 * @author subhi2
 */
@ManagedBean
@SessionScoped
public class PageController implements Serializable {

    public String moveToPage2() {

        NewJerseyClient client = new NewJerseyClient();

        ClientResponse response = client.findInsertedReservationItem(ClientResponse.class, "22", "2010-07-26T11:15:51", "2014-07-26T11:15:51");


        GenericType<List<ReservationItem>> genericType = new GenericType<List<ReservationItem>>() {
        };
// Returns an ArrayList of Players from the web service
        List<ReservationItem> data = new ArrayList<ReservationItem>();



        data = (response.getEntity(genericType));
        return data.toString();
    }
}

the line data = (response.getEntity(genericType)); cause the error

this code was working with old jersey but now what should I do to solve this error ?

like image 609
Mohammed Subhi Sheikh Quroush Avatar asked Jul 26 '13 08:07

Mohammed Subhi Sheikh Quroush


1 Answers

You can change response.getEntity(genericType) by response.readEntity(genericType)

like image 134
amgohan Avatar answered Oct 11 '22 21:10

amgohan