users@jersey.java.net

[Jersey] Re: How to use Jersey client with proxy server?

From: <juchems_mark_e_at_cat.com>
Date: Tue, 13 Aug 2013 13:00:32 +0000 (UTC)

We do this:

DefaultApacheHttpClientConfig config = new
DefaultApacheHttpClientConfig();
config.getState().setProxyCredentials(AuthScope.ANY_REALM,
"http://proxy.blah.com", 80, "");
config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PROXY_URI,
"http://proxy.blah.com:80");
config.getClasses().add(JacksonJsonProvider.class);
config.getClasses().add(MMSRestResponse.class);
this.theClient = ApacheHttpClient.create(config);
this.theClient.setReadTimeout(Integer.valueOf(pfa.getProperty("rest.rea
dTimeout")));
this.theClient.setConnectTimeout(Integer.valueOf(pfa.getProperty("rest.
connectTimeout")));


It takes care of proxys and the timeouts...