私は以下のようにしましたが、2番目のヘッダーと本文をどこに追加するのか分かりません。
String url = "http://xxx";
String name = "xxx";
String password = "yyy";
String authString = name + ":" + password;
String authStringEnc = new BASE64Encoder().encode(authString.getBytes());
System.out.println("Base64 encoded auth string: " + authStringEnc);
Client restClient = Client.create();
WebResource webResource = restClient.resource(url);
ClientResponse resp = webResource.accep`enter code here`t("application/json")
.header("Authorization", "Basic " + authStringEnc)
.get(ClientResponse.class);
if(resp.getStatus() != 200){
System.err.println("Unable to connect to the server");
}
String output = resp.getEntity(String.class);
System.out.println("response: "+output);
あなたのコード全体を記述しますか? – Akshay
まず自分自身を試してみましょう。障害のある方は – FieryCat
私のアプローチは投稿しました –