Using Web Proxies with Java 8 JAX-RS RESTEasy

I cannot force JAX-RS clients to use a web proxy in Java 8. I use RESTEasy 3.0.10.Final and run from Eclipse 4.4.2 on Windows 7 Professional 64-bit.

I installed the FreeProxy server on localhost running on 192.168.1.123:3128 . I include logs and telnet in 192.168.1.123 3128 and give out a GET manual. The request is displayed in the logs.

Then I launch my Java application by setting http.proxyHost=192.168.1.123 and http.proxyPort=3128 in the system properties. (I even tried it with -D when starting the JVM.) (Note that I did not expect the localhost problem to start, as I am connecting to the actual IP address, not localhost .)

I create a JAX-RS client using ClientBuilder.newBuilder().build() and execute a GET for the resource. FreeProxy logs do not display anything.

What do I need to do to get JAX-RS clients to use proxies?

+7
eclipse jax-rs resteasy
source share
1 answer

ResteasyClientBuilder provides a method for determining defaultProxy:

 ResteasyClient client = new ResteasyClientBuilder().defaultProxy("localhost", 8080, "http").build(); 
+6
source share

All Articles