如何从身份验证请求中获取使用会话的Web服务的cookie? 我无法更改Web服务实现。
public static Result authenticate(){
Form<Login> f = form(Login.class).bind(request().body().asJson());
Promise<WS.Response> result = WS.url("http://site/login")
.post("{\"login\":\"login\", \"password\":\"password\"}");
return async(result.map(
new Function<WS.Response, Result>() {
public Result apply(WS.Response response) throws Throwable {
if(response.getStatus() == OK){
JsonNode jn = response.asJson();
session("username", jn.get("login").toString());
// how can I get cookies from webservice?
return ok(jn);
}else{
return internalServerError();
}
}
}
)
);
}