1

I'm trying to call a webservice using the WSClient API from Play Framework. The main issue is that I want to transfer huge JSON payloads (more than 2MB) without exceeding the maximal payload size.

To do so, I would like to compress the request using gzip (with the HTTP header Content-Encoding: gzip). In the documentation, the parameter play.ws.compressionEnabled is mentioned, but it only seems to enable WSResponse compression.

I have tried to manually compress the payload (using a GZipOutputStream) and to put the header Content-Encoding:gzip, but the server throws a io.netty.handler.codec.compression.DecompressionException : Unsupported compression method 191 in the GZIP header.

How could I correctly compress my request ?

Thanks in advance

  • I think I read somewhere that you can configure the WSClient to enable this but haven't tried so not 100% - see `play.ws.compressionEnabled` at https://www.playframework.com/documentation/2.5.x/JavaWS#Configuring-WS – jacks Dec 07 '16 at 22:41

1 Answers1

0

Unfortunately I don't think you can compress the request (it is not supported by Netty, the underlying library). You can find more info in https://github.com/AsyncHttpClient/async-http-client/issues/93 and https://github.com/netty/netty/issues/2132

Salem
  • 12,808
  • 4
  • 34
  • 54