public abstract class RequestClientBuilder<R extends RequestClientBuilder<R,H>,H extends HttpRequestBuilder<H>> extends Object implements ClientBuilderInterface<R>, HttpRequestBuilderInterface<R>, Executable<Response>
Constructor and Description |
---|
RequestClientBuilder() |
Modifier and Type | Method and Description |
---|---|
R |
allowRedirects(boolean allowRedirects)
If follow get/head redirect, default true.
|
R |
auth(KeyCert cert)
秘钥认证
|
R |
auth(PasswordCert cert)
口令认证
|
R |
auth(String userName,
String password)
口令认证
|
R |
auth(String certPath,
String password,
String certType)
秘钥认证
|
R |
charset(Charset charset)
设置请求编码
|
R |
charset(String charset)
设置请求编码
|
R |
compress(boolean compress)
if send compress requests.
|
R |
connectTimeout(int timeout)
Set connect timeout in millis
|
R |
cookie(Cookie cookie)
增加单个cookie
|
R |
cookie(String domain,
String name,
String value)
增加单个cookie
|
R |
cookies(Map<String,Cookie> cookies)
批量增加cookie
|
Response |
execute()
执行请求操作
|
protected abstract ClientBuilder |
findClientBuilder() |
protected abstract HttpRequestBuilder<H> |
findRequsetBuilder() |
R |
header(String name,
String value)
增加单条HTTP报文首部参数
|
R |
headers(Map<String,String> maps)
批量增加HTTP报文首部参数
|
R |
intercept(List<RequestInterceptor> interceptorList)
批量注册请求拦截器
|
R |
intercept(RequestInterceptor interceptor)
注册请求拦截器
|
R |
param(String name,
Object value)
增加单条URL参数
|
R |
params(Map<String,Object> maps)
批量增加URL参数
|
R |
proxy(Proxy proxy)
代理
|
R |
proxy(String host,
int port)
无验证代理
|
R |
proxy(String host,
int port,
String proxyName,
String password)
带验证代理
|
protected abstract R |
self() |
R |
socketTimeout(int timeout)
Set socket timeout in millis
|
R |
timeout(int timeout)
Set socket timeout and connect timeout in millis
|
R |
timeToLive(long timeToLive)
how long http connection keep, in milliseconds.
|
R |
userAgent(String userAgent)
set userAgent
|
R |
verify(boolean verify)
if verify http certificate, default true
|
public R timeToLive(long timeToLive)
ClientBuilderInterface
timeToLive
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R userAgent(String userAgent)
ClientBuilderInterface
userAgent
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R verify(boolean verify)
ClientBuilderInterface
verify
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R allowRedirects(boolean allowRedirects)
ClientBuilderInterface
allowPostRedirects
if you want thisallowRedirects
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R compress(boolean compress)
ClientBuilderInterface
compress
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R timeout(int timeout)
ClientBuilderInterface
timeout
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R socketTimeout(int timeout)
ClientBuilderInterface
socketTimeout
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R connectTimeout(int timeout)
ClientBuilderInterface
connectTimeout
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R proxy(String host, int port, String proxyName, String password)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R proxy(String host, int port)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R proxy(Proxy proxy)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R auth(String userName, String password)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R auth(PasswordCert cert)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R auth(String certPath, String password, String certType)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R auth(KeyCert cert)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R intercept(RequestInterceptor interceptor)
ClientBuilderInterface
intercept
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R intercept(List<RequestInterceptor> interceptorList)
ClientBuilderInterface
intercept
in interface ClientBuilderInterface<R extends RequestClientBuilder<R,H>>
public R charset(String charset)
HttpRequestBuilderInterface
charset
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R charset(Charset charset)
HttpRequestBuilderInterface
charset
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R param(String name, Object value)
HttpRequestBuilderInterface
param
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R params(Map<String,Object> maps)
HttpRequestBuilderInterface
params
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R header(String name, String value)
HttpRequestBuilderInterface
header
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R headers(Map<String,String> maps)
HttpRequestBuilderInterface
headers
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R cookie(String domain, String name, String value)
HttpRequestBuilderInterface
cookie
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R cookie(Cookie cookie)
HttpRequestBuilderInterface
cookie
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public R cookies(Map<String,Cookie> cookies)
HttpRequestBuilderInterface
cookies
in interface HttpRequestBuilderInterface<R extends RequestClientBuilder<R,H>>
public Response execute()
Executable
execute
in interface Executable<Response>
protected abstract R self()
protected abstract ClientBuilder findClientBuilder()
protected abstract HttpRequestBuilder<H> findRequsetBuilder()
Copyright © 2006–2018 TinyGroup. All rights reserved.