我正在尝试将此行转换为resteasy的东西。
curl -X GET --digest -u myuser:mypassword --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances
这就是我尝试连接到该端点的方式
clientREST = new ResteasyClientBuilder().build();
clientREST.register(new BasicAuthentication(userWowza, passWowza));
String targetStr = "http://" + host + ":" + portEndpoint + endPoint + red5App + "/instances";
System.out.println(targetStr);
ResteasyWebTarget target = clientREST
.target(targetStr);
Response response = target.request().post(Entity.entity("", "application/json"));
if (response.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
}
但我得到HTTP错误代码:401。所以它就像用户和密码不起作用。我是否正确发送了标题?
所以我找不到任何带有digest auth的resteasy的例子,所以我发现wowza似乎同时支持基本和消化
答案 0 :(得分:0)
实际上,您的curl
使用--digest
而不是BASIC身份验证。所以看起来Server不接受BASIC授权架构。