java Jersey获取摘要或基本HTTP身份验证用户和密码
如何在Jersey 2.4中获取请求中的用户和密码
客户端请求设置用户和密码,如下所示
protected HttpAuthenticationFeature feature = HttpAuthenticationFeature.universalBuilder()
.credentialsForBasic("user", "123456") //these are not in header
.credentials("adminuser", "hello")
.build();
WebTarget loginTarget = webTarget.path("u").path("login");
loginTarget.register(feature);
ReturnMessage bean = loginTarget.request(MediaType.APPLICATION_JSON_TYPE).post(..
[新增]更多研究表明,这些值可以在JERSEY1的http头中获得。x、 但不是在2。x
共 (0) 个答案