private static synchronized JsApiTicket requestTicket() { Map<String, String> queryParas = ParaMap.create("access_token", getAccessToken().getAccessToken()).getData(); String json = HttpKit.get(ticUrl, queryParas); JsApiTicket jticket = new JsApiTicket(json); return jticket; }
private static synchronized AccessToken requestAccessToken() { AccessToken result = null; ApiConfig ac = ApiConfigKit.getApiConfig(); for (int i = 0; i < 3; i++) { String appId = ac.getAppId(); String appSecret = ac.getAppSecret(); Map<String, String> queryParas = ParaMap.create("appid", appId).put("secret", appSecret).getData(); String json = HttpKit.get(url, queryParas); result = new AccessToken(json); if (result.isAvailable()) break; } return result; }