cn.net.wanmo.apache.http.HttpConfig Maven / Gradle / Ivy
package cn.net.wanmo.apache.http;
import org.apache.http.client.config.RequestConfig;
public class HttpConfig {
public static RequestConfig build(HttpConfig config) {
RequestConfig.Builder custom = RequestConfig.custom();
if (config.socketTimeout != null) {
custom.setSocketTimeout(config.socketTimeout);
}
if (config.connectTimeout != null) {
custom.setConnectTimeout(config.connectTimeout);
}
return custom.build();
}
private Integer connectTimeout;
private Integer socketTimeout;
public HttpConfig() {
}
public Integer getConnectTimeout() {
return connectTimeout;
}
public void setConnectTimeout(Integer connectTimeout) {
this.connectTimeout = connectTimeout;
}
public Integer getSocketTimeout() {
return socketTimeout;
}
public void setSocketTimeout(Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}
}