There is a proxy server implementation, but, unfortunately, it is not even mentioned in the Jersey API client documentation (nor in the Jersey User Guide ) since version 2.22.1.
I found a JavaDoc for WebResourceFactory , an even better JavaDoc package . Here is a snippet from a JavaDoc on using WebResourceFactory:
Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/"); MyResourceIfc resource = WebResourceFactory.newResource(MyResourceIfc.class, target);
In Maven you then need to:
<dependency> <groupId>org.glassfish.jersey.ext</groupId> <artifactId>jersey-proxy-client</artifactId> <version>2.22.1</version> </dependency>
in addition to
<dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-client</artifactId> <version>2.22.1</version> </dependency>
source share