javax.ws.rs.client.Client 如何配置 readTimeOut?
2022-09-03 05:47:19
从 com.sun.jersey.api.client.Client 到 javax.ws.rs.client.Client.Client 如何配置 Client?
从:
import com.sun.jersey.api.client.Client;
Client client = Client.create();
client.setReadTimeout(1000 * 60 * 20);
client.setConnectTimeout(1000 * 20);
webResource = client.resource("someWhereOverTheRainbow");
..etc.
自:
import javax.ws.rs.client.*;
Client client = ClientBuilder.newClient();
// **now what?** client.getConfiguration().getProperties().put("isThisTheWayToDoIt", 1000 * 60 * 2);
WebTarget target = client.target("someWhereOverTheRainbow");
..etc.
我正在使用 javax.ws.rs-api-2.0.jar