Package com.wechat.pay.java.core.http
Class AbstractHttpClient
java.lang.Object
com.wechat.pay.java.core.http.AbstractHttpClient
- All Implemented Interfaces:
HttpClient
- Direct Known Subclasses:
ApacheHttpClientAdapter,OkHttpClientAdapter
请求客户端抽象基类
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription下载文件,文件流使用完后需要关闭<T> HttpResponse<T>execute(HttpRequest httpRequest, Class<T> responseClass) 发送HTTP请求protected abstract String获取http客户端信息,用于User-Agent。 格式:客户端名称/版本 示例:okhttp3/4.9.3protected abstract InputStreaminnerDownload(HttpRequest httpRequest) protected abstract OriginalResponseinnerExecute(HttpRequest httpRequest) protected booleanisInvalidHttpCode(int httpCode)
-
Field Details
-
credential
-
validator
-
-
Constructor Details
-
AbstractHttpClient
-
-
Method Details
-
execute
Description copied from interface:HttpClient发送HTTP请求- Specified by:
executein interfaceHttpClient- Type Parameters:
T- 由Class对象建模的类的类型- Parameters:
httpRequest- HTTP请求responseClass- 业务返回类的Class对象,如果不确定业务返回类型,或该请求没有返回体,可以传入Object.class- Returns:
- HTTP返回
-
download
Description copied from interface:HttpClient下载文件,文件流使用完后需要关闭- Specified by:
downloadin interfaceHttpClient- Parameters:
url- 请求URL- Returns:
- 文件流
-
innerDownload
-
innerExecute
-
isInvalidHttpCode
protected boolean isInvalidHttpCode(int httpCode) -
getHttpClientInfo
获取http客户端信息,用于User-Agent。 格式:客户端名称/版本 示例:okhttp3/4.9.3- Returns:
- 客户端信息
-