gpt4 book ai didi

netbeans - Jersey 2 库 response.getEntity 不存在我应该使用什么代替

转载 作者:行者123 更新时间:2023-12-04 19:08:47 25 4
gpt4 key购买 nike

我的代码

/*
* 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();
}
}

线
数据 = (response.getEntity(genericType));
导致错误

这段代码适用于旧 Jersey ,但现在我应该怎么做才能解决这个错误?

最佳答案

您可以通过 response.readEntity(genericType) 更改 response.getEntity(genericType)

关于netbeans - Jersey 2 库 response.getEntity 不存在我应该使用什么代替,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17876632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com