【发布时间】:2018-05-31 15:42:24
【问题描述】:
Client client = Client.create();
WebResource webResource = client
.resource("my url");
String name = "adn";
String password = "34";
String authString = name + ":" + password;
String authStringEnc = new BASE64Encoder().encode(authString
.getBytes());
// System.out.println("Base64 encoded auth string: " +
// authStringEnc);
ClientResponse response = webResource.accept("application/json")
.header("Authorization", "Basic " + authStringEnc)
.get(ClientResponse.class);
String output = response.getEntity(String.class);
System.out.println(output);
我得到这样的o/p
{"counts":[{"college_name":"GPT , Karimngr","college_epass_id":18},
{"college_name":"GPT, Dra","college_epass_id":444},
我想将该 json 数据类型转换为 java 对象,请您提出建议。
【问题讨论】: