如何避免:"blockingToByteString is a blocking and unsafe operation"



在我的播放项目中,我想获得我从休息服务获得的文件的消息摘要。

服务电话:

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

从响应(WSResponse)中我提取身体,例如:

response.bodyAsBytes.toByteBuffer.array()

这给了我这个警告:

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

是否有一种避免此警告的方法。

最终提到的我需要一个 Array[Byte]来摘要。

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

呼叫execute而不是stream喜欢

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

然后,您可以将wsresponse读取为JSON/String等,而无需阻止警告

最新更新