3

In my Play Project I want to get the Message Digest of a File that I get from a REST Service.

Service call:

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

From the Response (WSResponse) I extract the body like:

response.bodyAsBytes.toByteBuffer.array()

This gives me this warning:

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

Is there a way to avoid this warning.

As mentioned in the end I need an Array[Byte] for the Message Digest.

pme
  • 14,156
  • 3
  • 52
  • 95

1 Answers1

3

It might be a little bit late but I had the same problem and there was no answer, so here it is:

call execute instead of stream like

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

Then you can read WSResponse as json / string etc. without blocking warning

cuZzior
  • 76
  • 6