首页 > 解决方案 > Play WSClient url 无法访问

问题描述

我在我的游戏框架中使用 WS java 客户端。但我收到以下回复。我的来源是

 WSRequest request = ws.url("http://localhost:9000/office");
 CompletionStage<String> response = request.get().thenApply(x -> x.getBody());

 String s = response.toCompletableFuture().get();
 System.out.println(s);

输出如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
        <title>Error response</title>
    </head>
    <body>
        <h1>Error response</h1>
        <p>Error code: 400</p>
        <p>Message: Bad Request.</p>
        <p>Error code explanation: 400 - Bad request syntax or unsupported method.</p>
    </body>
</html>

我已将所有预先启用的过滤器禁用为“play.filters.enabled = []”。我真的很欣赏你的建议。

标签: playframeworkwebclient

解决方案


推荐阅读