public class DefaultQimenClient extends Object implements QimenClient
| Modifier and Type | Field and Description |
|---|---|
protected String |
appKey |
protected String |
appSecret |
protected int |
connectTimeout |
protected String |
format |
protected boolean |
needEnableParser |
protected int |
readTimeout |
protected String |
serverUrl |
protected String |
signMethod |
protected boolean |
useGzipEncoding |
| Constructor and Description |
|---|
DefaultQimenClient(String serverUrl,
String appKey,
String appSecret) |
| Modifier and Type | Method and Description |
|---|---|
void |
enableHttpDns()
启用http dns
|
void |
enableHttpDns(String onlineAppKey,
String onlineAppSecret)
沙箱环境启用http dns
|
<T extends QimenResponse> |
execute(QimenRequest<T> request)
执行公开API请求。
|
<T extends QimenResponse> |
execute(QimenRequest<T> request,
String session)
执行隐私API请求。
|
String |
getServerUrl(String serverUrl) |
String |
getTopHttpDnsHost() |
void |
setConnectTimeout(int connectTimeout)
设置API请求的连接超时时间,默认为15秒。
|
void |
setIgnoreSSLCheck(boolean ignore)
是否忽略HTTPS证书校验。
|
void |
setNeedEnableLogger(boolean needEnableLogger)
是否记录API请求错误日志。
|
void |
setNeedEnableParser(boolean needEnableParser)
是否把响应字符串解释为对象。
|
void |
setReadTimeout(int readTimeout)
设置API请求的读超时时间,默认为30秒。
|
void |
setUseGzipEncoding(boolean useGzipEncoding)
是否启用响应GZIP压缩
|
protected String serverUrl
protected String appKey
protected String appSecret
protected String format
protected String signMethod
protected int connectTimeout
protected int readTimeout
protected boolean needEnableParser
protected boolean useGzipEncoding
public <T extends QimenResponse> T execute(QimenRequest<T> request) throws ApiException
QimenClientexecute in interface QimenClientT - 具体的API响应类request - 具体的API请求类ApiExceptionpublic <T extends QimenResponse> T execute(QimenRequest<T> request, String session) throws ApiException
QimenClientexecute in interface QimenClientT - 具体的API响应类request - 具体的API请求类session - 用户授权码ApiExceptionpublic void setNeedEnableParser(boolean needEnableParser)
public void setNeedEnableLogger(boolean needEnableLogger)
public void setIgnoreSSLCheck(boolean ignore)
public void setUseGzipEncoding(boolean useGzipEncoding)
public void setConnectTimeout(int connectTimeout)
public void setReadTimeout(int readTimeout)
public String getTopHttpDnsHost()
public void enableHttpDns()
Copyright © 2021. All rights reserved.