I have a web application where at a certain point I make requests in endpoint
using JAX-RS RestEasy
as follows:
// Outros códigos acima
@Inject
private Client client;
...
WebTarget webTarget = client.target(URL).path(ENDPOINT);
Response response = webTarget.request().post// continua
Until then I can normally do POST, however, I need to consider setting the HTTP timeout for this operation. Searching I noticed that the staff uses the Jersey to perform the following configuration:
client.property(ClientProperties.CONNECT_TIMEOUT, 1000);
client.property(ClientProperties.READ_TIMEOUT, 1000);
I do not use this dependency in the project, and only by testing did I try to use and by running the application on Wildfly a series of exceptions and conflicts arise due to conflicts with other required dependencies.
One important note is that the client object is injected via CDI .
Well, I wonder how I could set the timeout without using this dependency on Jersey?