zoukankan      html  css  js  c++  java
  • 调用第三方http接口

    // /**
    // * 调用第三方接口查询指定账号的信息
    // * @param uid 账号
    // * @return 用户信息
    // */
    // @Override
    // public UserInfo matchUserInfo(String uid) {
    // // // 记录日志
    // // FileOperateLogReq fileOperateLog = LogParamUtil.getLogParam();
    // // // 设置日记录菜单
    // // fileOperateLog.setLeveOneMenu("系统管理");
    // // fileOperateLog.setLeveTwoMenu("账号管理");
    // // fileOperateLog.setOperateType("查询");
    // // logDao.noteFileOperate(fileOperateLog);
    // // 创建Httpclient对象
    // CloseableHttpClient httpClient = HttpClients.createDefault();
    // CloseableHttpResponse response = null;
    // String url = "https://login-beta.huawei.com/sso/rest/user";
    // String resultString = "";
    // UserInfo userInfo = new UserInfo();
    // try {
    // // 创建uri
    // URIBuilder builder = new URIBuilder(url + "/" + uid);
    // URI uri = builder.build();
    // // 创建Http Get请求
    // HttpGet httpGet = new HttpGet(uri);
    // // 执行http请求
    // response = httpClient.execute(httpGet);
    // if (response.getEntity() == null) {
    // return userInfo;
    // }
    // resultString = EntityUtils.toString(response.getEntity(), "utf-8");
    // userInfo = JSON.parseObject(resultString, UserInfo.class);
    // } catch (URISyntaxException e) {
    // if (DEBUG_LOGGER.isInfoEnabled()) {
    // DEBUG_LOGGER.info("exception infomation:", e.getMessage());
    // }
    // } catch (ClientProtocolException e) {
    // if (DEBUG_LOGGER.isInfoEnabled()) {
    // DEBUG_LOGGER.info("exception infomation:", e.getMessage());
    // }
    // } catch (IOException e) {
    // if (DEBUG_LOGGER.isInfoEnabled()) {
    // DEBUG_LOGGER.info("exception infomation:", e.getMessage());
    // }
    // } catch (JSONException e) {
    // if (DEBUG_LOGGER.isInfoEnabled()) {
    // DEBUG_LOGGER.info("exception infomation:", e.getMessage());
    // }
    // } finally {
    // try {
    // if (response != null) {
    // response.close();
    // }
    // } catch (IOException e) {
    // if (DEBUG_LOGGER.isInfoEnabled()) {
    // DEBUG_LOGGER.info("exception infomation:", e.getMessage());
    // }
    // }
    // }
    // return userInfo;
    // }

    历经苦难而不厌,此乃阿修罗之道。
  • 相关阅读:
    ARC108解题报告
    整体dp小结
    SAM学习笔记&AC自动机复习
    Error creating bean with name 'bootstrapImportSelectorConfiguration':
    responseBody
    无力回天的CSP2020
    NOIP2020游记
    2020国家集训队作业选做
    flutter开发使用AnnotatedRegion修改状态栏字体颜色,导致导航栏也变黑了的解决方法
    flutter使用InkWell点击没有水波纹效果的解决方法
  • 原文地址:https://www.cnblogs.com/echo1314/p/11688593.html
Copyright © 2011-2022 走看看