3

在我的 Play 项目中,我想获取从 REST 服务获得的文件的消息摘要。

服务电话:

ws.url("deployment/data/idResource").withMethod("GET").stream

从 Response ( WSResponse) 我提取身体,如:

response.bodyAsBytes.toByteBuffer.array()

这给了我这个警告:

p.a.l.w.a.StandaloneAhcWSClient$ - blockingToByteString is a blocking and unsafe operation!

有没有办法避免这个警告。

正如最后提到的,我需要一个Array[Byte]消息摘要。

4

1 回答 1

3

可能有点晚了,但我遇到了同样的问题,没有答案,所以这里是:

打电话execute而不是stream喜欢

ws.url("deployment/data/idResource").withMethod("GET").execute

然后您可以将 WSResponse 读取为 json / string 等而不会阻止警告

于 2021-02-18T09:58:52.967 回答