Builder
- public abstract class ClientBuilder<Builder extends ClientBuilder<Builder>> extends Object implements ClientBuilderInterface<Builder>
Modifier and Type | Method and Description |
---|---|
Builder |
allowRedirects(boolean allowRedirects)
If follow get/head redirect, default true.
|
Builder |
auth(KeyCert cert)
秘钥认证
|
Builder |
auth(PasswordCert cert)
口令认证
|
Builder |
auth(String userName,
String password)
口令认证
|
Builder |
auth(String certPath,
String password,
String certType)
秘钥认证
|
ClientInterface |
build()
构建客户端实例
|
Builder |
compress(boolean compress)
if send compress requests.
|
Builder |
connectTimeout(int timeout)
Set connect timeout in millis
|
protected Context |
getContext() |
protected Context |
getContext(HttpConfigTemplate template) |
List<RequestInterceptor> |
getInterceptorList() |
Builder |
intercept(List<RequestInterceptor> interceptorList)
批量注册请求拦截器
|
Builder |
intercept(RequestInterceptor interceptor)
注册请求拦截器
|
Builder |
proxy(Proxy proxy)
代理
|
Builder |
proxy(String host,
int port)
无验证代理
|
Builder |
proxy(String host,
int port,
String proxyName,
String password)
带验证代理
|
protected abstract Builder |
self() |
Builder |
socketTimeout(int timeout)
Set socket timeout in millis
|
Builder |
timeout(int timeout)
Set socket timeout and connect timeout in millis
|
Builder |
timeToLive(long timeToLive)
how long http connection keep, in milliseconds.
|
Builder |
userAgent(String userAgent)
set userAgent
|
Builder |
verify(boolean verify)
if verify http certificate, default true
|
protected abstract Builder self()
public ClientInterface build()
protected Context getContext()
protected Context getContext(HttpConfigTemplate template)
public Builder timeToLive(long timeToLive)
ClientBuilderInterface
timeToLive
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder userAgent(String userAgent)
ClientBuilderInterface
userAgent
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder verify(boolean verify)
ClientBuilderInterface
verify
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder allowRedirects(boolean allowRedirects)
ClientBuilderInterface
allowPostRedirects
if you want thisallowRedirects
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder compress(boolean compress)
ClientBuilderInterface
compress
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder timeout(int timeout)
ClientBuilderInterface
timeout
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder socketTimeout(int timeout)
ClientBuilderInterface
socketTimeout
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder connectTimeout(int timeout)
ClientBuilderInterface
connectTimeout
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder proxy(String host, int port, String proxyName, String password)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder proxy(String host, int port)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder proxy(Proxy proxy)
ClientBuilderInterface
proxy
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder auth(String userName, String password)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder auth(PasswordCert cert)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder auth(String certPath, String password, String certType)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder auth(KeyCert cert)
ClientBuilderInterface
auth
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder intercept(RequestInterceptor interceptor)
ClientBuilderInterface
intercept
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public Builder intercept(List<RequestInterceptor> interceptorList)
ClientBuilderInterface
intercept
in interface ClientBuilderInterface<Builder extends ClientBuilder<Builder>>
public List<RequestInterceptor> getInterceptorList()
Copyright © 2006–2018 TinyGroup. All rights reserved.