相关疑难解决方法(0)

用什么代替org.jboss.resteasy.client.ClientRequest?

我刚发现它org.jboss.resteasy.client.ClientRequest已被弃用,使我在Google上找到的有关如何使用RESTEasy客户端的所有内容无效.在Javadoc中没有给出指示,以什么来代替使用.谷歌同样沉默.

2.3.5现在已经恢复了,但是无论如何都会对答案感兴趣,以及如何在不问别人知道的情况下如何找到答案 - 是否有资源可以查看我所看到的信息?

java jboss resteasy

28
推荐指数
2
解决办法
2万
查看次数

在最新版本(3.0.x)Resteasy 中,我们应该使用什么 ClientResponse 和 GenericType?

我正在开发Resteasy。我将应用程序的 Maven 依赖项从 迁移2.2.x3.0.x,突然发现大多数 API 都已弃用。因此,此迁移对我的代码和测试用例产生了影响,因为它只是说在我的整个代码中已弃用。

我正在以我的测试用例为例:早期版本的测试用例(在最新版本中,它已弃用,如链接中所述:ClientRequestFactory RestEasy 已弃用...任何其他 RestEasy 替代方案吗?):

import org.jboss.resteasy.util.GenericType;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;

@Test
    public void testGetStudent() throws Exception{
        String str = "http://localhost:8080/RESTfulExample/rest/restwebservice/list";
        ClientRequest request = new ClientRequest(str);
        ClientResponse<List<Student>> response = request.get(new GenericType<List<Student>>(){});
        List<Student> students = response.getEntity();
        System.out.println("Size : "+students.size());
    }
Run Code Online (Sandbox Code Playgroud)

所以我重构我的测试用例以使用

@Test
    public void testGetStudents(){
        final String str = "http://localhost:8080/RESTfulExample/rest/restwebservice/list";
        Client client = ClientBuilder.newClient();
        // Client client = ClientBuilder.newBuilder().build();  // This also works, OR

        Response response = …
Run Code Online (Sandbox Code Playgroud)

deprecated resteasy

2
推荐指数
1
解决办法
6202
查看次数

标签 统计

resteasy ×2

deprecated ×1

java ×1

jboss ×1