-
Enhancement
-
Resolution: Done
-
Major
-
None
-
-
-
-
-
-
https://gitlab.cee.redhat.com/red-hat-jboss-enterprise-application-platform-documentation/eap-documentation/merge_requests/5051, https://gitlab.cee.redhat.com/red-hat-jboss-enterprise-application-platform-documentation/eap-documentation/-/merge_requests/5091?commit_id=a8b0c60241ba1191ce114bd1ef86ff1bc788d557
2.2. JAX-RS Client
With EAP 7.2+ , the JAXRS 2.1 included the ability to set the timeouts [2]. With this you do not have to use the ResteasyClientBuilder. ResteasyClientBuilder extends the javax.ws.rs.client.ClientBuilder , so if you do need to invoke some non spec method, you can still use ResteasyClientBuilder and call connectTimeout / readTimeout on it.
These old methods on ResteasyClientBuilder were deprecated in favor of the spec methods:
establishConnectionTimeout => connectTimeout
socketTimeout => readTimeout
import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Client; Client client = ClientBuilder.newBuilder() .connectTimeout(100, TimeUnit.SECONDS) .readTimeout(2, TimeUnit.SECONDS) .build();
We should clarify the standard way: 'Using the Standard Way to Create a Client' , is the JavaEE /JAXRS spec defined way, which is portable. Using the RESTEasy way is not portable since it depends on RESTEasy.
[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.3.beta/html/developing_web_services_applications/developing_jax_rs_web_services
[2] https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/client/ClientBuilder.html
- links to