如何查看 Jersey 生成并发送到服务器的实际请求?我遇到了特定请求的问题,运行网络服务器的人要求查看完整的请求(带有 header 等)。
最佳答案
如果您只是使用 Jersey 客户端 API,LoggingFilter (客户端过滤器)应该可以帮助您:
Client client = Client.create();
client.addFilter(new LoggingFilter(System.out));
WebResource webResource = client.resource("http://localhost:9998/");
ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
否则,您可以使用其他 LoggingFilter 再次在服务器上记录请求和响应。 (容器过滤器)。
关于java - Jersey:打印实际请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6860661/