All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.net.wanmo.apache.http.HttpConfig Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy