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

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

There is a newer version: 1.0.4
Show newest version
package cn.net.wanmo.common.http.apache;

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