private void generateResponseData(HttpResponse httpResponse) { try { response = Response.valueOf(httpResponse.getBody()); } catch (Exception e) { e.printStackTrace(); response = new Response(httpResponse); } fillResponseHeader(httpResponse.getHeader()); }
@Override public final void onResponse(int statusCode, Map<String, String> header, String body) { HttpResponse httpResponse = new HttpResponse(responseType, statusCode, method, url, header); httpResponse.setBody(body); for (IApiHook hook : obtainHookList()) { hook.onResponse(API_NAME, responseType, httpResponse); } generateResponseData(httpResponse); for (IApiHook hook : obtainHookList()) { hook.onResponseData(API_NAME, responseType, response, Response.class); } onResponse(statusCode, response); }