1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
public final class Request {
public static Request create(String method, String url, Map<String, Collection<String>> headers, byte[] body, Charset charset) { return new Request(method, url, headers, body, charset); }
private final String method; private final String url; private final Map<String, Collection<String>> headers; private final byte[] body; private final Charset charset;
Request(String method, String url, Map<String, Collection<String>> headers, byte[] body, Charset charset) { this.method = checkNotNull(method, "method of %s", url); this.url = checkNotNull(url, "url"); this.headers = checkNotNull(headers, "headers of %s %s", method, url); this.body = body; this.charset = charset; }
public static class Options {
private final int connectTimeoutMillis; private final int readTimeoutMillis;
public Options(int connectTimeoutMillis, int readTimeoutMillis) { this.connectTimeoutMillis = connectTimeoutMillis; this.readTimeoutMillis = readTimeoutMillis; }
public Options() { this(10 * 1000, 60 * 1000); }
} }
|