如何在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.x的http标头中获取,但不能在2.x
中获取