Using web proxy with Java 8 JAX-RS RESTEasy clients
It seems to be possible to make RESTeasy use Java's proxy properties (e.g. -Dhttp.proxyHost
) by using a different engine instead of HttpClient
. java.net.HttpURLConnection
supports proxy properties out of the box:
ResteasyClient client = new ResteasyClientBuilder().httpEngine(new URLConnectionEngine()).build();
The ResteasyClientBuilder provides a method to define the defaultProxy:
ResteasyClient client = new ResteasyClientBuilder().defaultProxy("localhost", 8080, "http").build();