Configuring proxy for JAX-RS 2.0 client API

不羁岁月 提交于 2019-11-30 22:38:06

I think there's no vendor independent solution (at least, I didn't find anything related to proxies in the JAX-RS API).

For Jersey 2.x, you can try:

ClientConfig config = new ClientConfig();
config.property(ClientProperties.PROXY_URI, "192.168.1.254:8080");  
Client client = ClientBuilder.withConfig(config).build();

ClientProperties is a class from Jersey API.


For RESTEasy, the configuration is:

Client client = new ResteasyClientBuilder()
                   .defaultProxy("192.168.1.254", 8080, "http")
                   .build();

ResteasyClientBuilder is a class from RESTEasy API.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!