-
-
Save p4535992/60d3cbe89cb38e3944c32bf1ef28b60c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.cxf.configuration.jsse.TLSClientParameters; | |
| import org.apache.cxf.helpers.IOUtils; | |
| import org.apache.cxf.jaxrs.client.WebClient; | |
| import org.apache.cxf.transport.http.HTTPConduit; | |
| import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; | |
| ... | |
| WebClient client = WebClient.create(uri); | |
| // Add proxy | |
| HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit(); | |
| HTTPClientPolicy policy = new HTTPClientPolicy(); | |
| policy.setProxyServer("someproxy.com.sg"); | |
| policy.setProxyServerPort(3128); | |
| conduit.setClient(policy); | |
| // accept json response | |
| client.accept(MediaType.APPLICATION_JSON); | |
| // do actual calling to http://google.com | |
| final Response response = client.get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment