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

com.gitee.cliveyuan.tools.cons.NetCons Maven / Gradle / Ivy

There is a newer version: 4.0.6
Show newest version
package com.gitee.cliveyuan.tools.cons;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 网络常量
 *
 * @author clive
 * Created on 2018/07/24
 * @since 1.0
 */
public class NetCons {

    /**
     * 默认请求头
     */
    public static final Map DEFAULT_HEADERS = Maps.newHashMap();


    /**
     * jsop默认超时时间, 单位:毫秒
     */
    public static final int JSOUP_TIME_OUT = 30 * 1000;
    /**
     * httpClient默认超时时间, 单位:毫秒
     */
    public static final int HTTP_CLIENT_TIME_OUT = 30 * 1000;

     static  {
        DEFAULT_HEADERS.put("Accept", "*/*");
        DEFAULT_HEADERS.put("Accept-Encoding", "gzip, deflate");
        DEFAULT_HEADERS.put("Accept-Language", "en-US,en;q=0.9");
        DEFAULT_HEADERS.put("Connection", "keep-alive");
        DEFAULT_HEADERS.put("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) "
                + "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36");
        DEFAULT_HEADERS.put("X-Requested-With", "XMLHttpRequest");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy