UnirestForgeRockUserDao.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:dcsi 作者:
@Override
public List<User> readUsers(String locatie) {
    try {
        HttpResponse<JsonNode> getResponse = Unirest
                .get("http://localhost:8080/openidm/managed/user?_prettyPrint=true&_queryId=query-all")
                .header("Accept", "application/json")
                .header("Content-Type", "application/json")
                .header("X-Requested-With", "Swagger-UI")
                .header("X-OpenIDM-Username", "openidm-admin")
                .header("X-OpenIDM-Password", "openidm-admin")
                .asJson();

        JSONObject body = getResponse.getBody().getObject();
        System.out.println(body.toString(4));
        JSONArray users = body.getJSONArray("result");
        List<User> result = new ArrayList<>();
        for (int i = 0, maxi = users.length(); i < maxi; i++) {
            result.add(toUser((JSONObject) users.get(i)));
        }
        return result;
    } catch (UnirestException e) {
        throw new RuntimeException("Wrapped checked exception.", e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号