类 WechatHttp
java.lang.Object
com.abasecode.opencode.pay.plugin.wechatpay.util.WechatHttp
- 作者:
- Jon e-mail: ijonso123@gmail.com url: Jon's blog url: project github url: AbaseCode.com
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private static org.apache.http.HttpResponsegetGetResponse(String url, String json) 获得GET方法返回bodystatic StringgetJsapiSign(String appId, String timestamp, String nonceStr, String packages) JSAPI SIGN(小程序,公众号通用)private static org.apache.http.HttpResponsegetPostResponse(String url, String json) 获得POST方法返回bodystatic Stringget sign with RSAprivate static <T> TgetTbyResult(Class<T> t, int statusCode, String jsonString, T instance) 将JSON文本转换成目标实体类static <T> T发起HTTP请求,并返回实体static <T> T发起Post请求static StringGet http signprivate static Stringget http token
-
构造器详细资料
-
WechatHttp
public WechatHttp()
-
-
方法详细资料
-
httpGet
发起HTTP请求,并返回实体- 类型参数:
T- 目标实体- 参数:
url- 目标URLjson- 参数(GET参数)t- 目标实体.class- 返回:
- 目标实体
- 抛出:
Exception
-
httpPost
发起Post请求- 类型参数:
T- 目标实体- 参数:
url- 目标URLjson- 参数(POST参数)t- 目标实体.class- 返回:
- 目标实体
- 抛出:
Exception
-
getTbyResult
将JSON文本转换成目标实体类- 类型参数:
T- 目标类- 参数:
t- 目标实体statusCode- http状态码jsonString- JsonStringinstance- 实例- 返回:
- 目标类
-
getPostResponse
private static org.apache.http.HttpResponse getPostResponse(String url, String json) throws Exception 获得POST方法返回body- 参数:
url-json-- 返回:
- HttpResponse
- 抛出:
Exception
-
httpToken
get http token- 参数:
method- GET POSTurlString- URLbody- Post method with JSON, Get method with ""- 返回:
- String
- 抛出:
Exception
-
getGetResponse
private static org.apache.http.HttpResponse getGetResponse(String url, String json) throws Exception 获得GET方法返回body- 参数:
url- urljson- json- 返回:
- HttpResponse
- 抛出:
Exception
-
httpSign
public static String httpSign(String method, String urlString, String body, long timestamp, String nonceStr) throws Exception Get http sign- 参数:
method- GET POSTurlString- URLbody- Post method with JSON, Get method with ""timestamp- timestampnonceStr- Random String- 返回:
- String
- 抛出:
Exception
-
getJsapiSign
public static String getJsapiSign(String appId, String timestamp, String nonceStr, String packages) throws Exception JSAPI SIGN(小程序,公众号通用)- 参数:
timestamp- timestampnonceStr- Random Stringpackages- body- 返回:
- String
- 抛出:
Exception
-
getSign
get sign with RSA- 参数:
signatureStr-- 返回:
- String
- 抛出:
Exception
-