类 DefaultApiClient
- java.lang.Object
-
- com.getui.push.v2.sdk.core.client.DefaultApiClient
-
public class DefaultApiClient extends Object
1. 管理token 2. 解析请求参数 3. 发送HTTP请求 4. 解析请求结果 create by getui on 2020/6/2- 作者:
- getui
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected voidafterDoExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, String result)调用接口后调用此方法protected voidbeforeExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body)执行http调用之前调用此方法static DefaultApiClientbuild(GtApiConfiguration apiConfiguration, IJson json)voidclose()释放cache中的对象,但是此对象仍然可以使用,直到没有内存引用被回收ApiResult<?>execute(GtApiProxyFactory.ApiParam apiParam)1.protected voidhandleException(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, ApiException e)调用远程接口报错后调用此方法protected voidpostExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, String result)调用远程接口后调用此方法,如果报错则不会调用voidsetAuthApiAndAuth(AuthApi authApi)voidsetJson(IJson json)
-
-
-
方法详细资料
-
build
public static DefaultApiClient build(GtApiConfiguration apiConfiguration, IJson json)
-
beforeExecute
protected void beforeExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body)
执行http调用之前调用此方法- 参数:
apiParam- 请求参数header- 请求headerbody- 请求body
-
execute
public ApiResult<?> execute(GtApiProxyFactory.ApiParam apiParam)
1. 调用接口 2. 如果返回token失效,刷新token后再次调用- 参数:
apiParam-- 返回:
-
postExecute
protected void postExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, String result)
调用远程接口后调用此方法,如果报错则不会调用- 参数:
apiParam- http请求的参数header- http请求的headerbody- http请求的body
-
handleException
protected void handleException(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, ApiException e)
调用远程接口报错后调用此方法- 参数:
apiParam- http请求的参数header- http请求的headerbody- http请求的bodye- http请求抛出的异常
-
afterDoExecute
protected void afterDoExecute(GtApiProxyFactory.ApiParam apiParam, Map<String,Object> header, String body, String result)
调用接口后调用此方法- 参数:
apiParam- http请求的参数header- http请求的headerbody- http请求的bodyresult- http请求的返回值
-
setJson
public void setJson(IJson json)
-
close
public void close()
释放cache中的对象,但是此对象仍然可以使用,直到没有内存引用被回收
-
setAuthApiAndAuth
public void setAuthApiAndAuth(AuthApi authApi)
-
-