2

我正在尝试使用公司代理后面的播放框架进行 WS 调用。目前我在 build.bat 文件中有我的 http.proxyHost(user,pass,port) 参数。我可以与所需的外部 url 建立 URL 连接,但是在尝试使用 Play 的 WS api 时,我收到 407 authentication required 错误。我尝试从 build.bat 中删除代理身份验证参数并将参数放在 application.conf 文件中,但这没有任何区别。

    final Promise<Result> result = WS.url(endpoint).get().map(
            new Function<WS.Response, Result>() {
                public Result apply(WS.Response response) {
                    return ok(response.getStatus() + " " + response.getBody() + " " + response.getStatusText());
                }
            }
    );

更新:在调试时,我查看了配置对象中的值,一切似乎都已设置。对为什么我仍然遇到身份验证问题感到困惑......

Play.application().configuration().getString("http.proxyHost")
Play.application().configuration().getString("http.proxyPort")
Play.application().configuration().getString("http.proxyUser")
Play.application().configuration().getString("http.proxyPassword")
4

1 回答 1

-1

我不知道为什么,但设置ws.useProxyProperties=false似乎有效。我认为应用程序需要使用构建文件中的代理属性,但似乎不需要。

于 2014-09-17T14:02:51.737 回答