Skip to content

Instantly share code, notes, and snippets.

@eshioji
Created October 10, 2012 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eshioji/3868631 to your computer and use it in GitHub Desktop.
Save eshioji/3868631 to your computer and use it in GitHub Desktop.
Usage example
public MyService(Config config) {
HttpClient.Builder builder = new HttpClient.Builder();
builder
.setUserAgent(config.value(Prop.USER_AGENT, String.class))
.setRequestTimeout(config.value(Prop.REQ_TIMEOUT,Integer.class))
// etc.etc….
.setCompression(config.value(Prop.COMPRESSION_ENABLED, Boolean.class));
if(config.value(Prop.PROXY_ENABLED,Boolean.class)){
Proxy proxy = config.value(Prop.PROXY,Proxy.class);
builder.setProxy(proxy);
}
client = builder.build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment