Configure proxy to Jersey client

前端 未结 3 1182
悲哀的现实
悲哀的现实 2020-12-14 04:46

I would like to configure a proxy server to my Jersey client.
I don\'t want to configure the proxy to the whole application (using JVM arguments such as http.proxyHost),

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 05:32

    Try

    Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
    conn = new URL(url).openConnection(proxy);
    

提交回复
热议问题