public interface BaseWxChannelService extends WxService
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkSignature(String timestamp,
String nonce,
String signature)
验证消息的确来自微信服务器.
|
<T,E> T |
execute(RequestExecutor<T,E> executor,
String uri,
E data)
Service没有实现某个API的时候,可以用这个,
比
WxService.get(java.lang.String, java.lang.String)和WxService.post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 |
<T,E> T |
executeWithoutLog(RequestExecutor<T,E> executor,
String uri,
E data)
执行器
|
String |
getAccessToken()
获取access_token, 不强制刷新access_token.
|
String |
getAccessToken(boolean forceRefresh)
获取access_token,本方法线程安全.
|
WxChannelConfig |
getConfig()
WxChannelConfig对象
|
RequestHttp |
getRequestHttp()
请求http请求相关信息.
|
void |
initHttp()
初始化http请求对象.
|
void |
setConfig(WxChannelConfig config)
注入
WxChannelConfig 的实现. |
void |
setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数.
|
void |
setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试.
|
boolean checkSignature(String timestamp, String nonce, String signature)
验证消息的确来自微信服务器. 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN
timestamp - the timestampnonce - the noncesignature - the signatureString getAccessToken() throws WxErrorException
WxErrorException - the wx error exception#getAccessToken(boolean)String getAccessToken(boolean forceRefresh) throws WxErrorException
获取access_token,本方法线程安全. 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限 使用【稳定版接口】获取access_token时,限制【20次/日】,连续使用该模式时,请保证调用时间隔至少为30s,否则不会刷新 程序员在非必要情况下尽量不要主动调用此方法 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183&token=&lang=zh_CN
forceRefresh - 强制刷新WxErrorException - the wx error exception<T,E> T execute(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
Service没有实现某个API的时候,可以用这个, 比WxService.get(java.lang.String, java.lang.String)和WxService.post(java.lang.String, java.lang.String)方法更灵活,可以自己构造RequestExecutor用来处理不同的参数和不同的返回类型。 可以参考,MediaUploadRequestExecutor的实现方法
T - .E - .executor - 执行器uri - 接口请求地址data - 参数或请求数据WxErrorException - the wx error exception<T,E> T executeWithoutLog(RequestExecutor<T,E> executor, String uri, E data) throws WxErrorException
T - .E - .executor - 执行器uri - 接口请求地址data - 参数或请求数据WxErrorException - the wx error exceptionvoid setRetrySleepMillis(int retrySleepMillis)
设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试. 默认:1000ms
retrySleepMillis - 重试等待毫秒数void setMaxRetryTimes(int maxRetryTimes)
设置当微信系统响应系统繁忙时,最大重试次数. 默认:5次
maxRetryTimes - 最大重试次数WxChannelConfig getConfig()
void setConfig(WxChannelConfig config)
WxChannelConfig 的实现.config - configvoid initHttp()
RequestHttp getRequestHttp()
Copyright © 2025. All rights reserved.