我正尝试使用Play Framework的WSClient
API调用webservice。 主要问题是我想传输巨大的JSON有效负载(超过2MB)而不超过最大有效负载大小。来自Play Framework的WSClient的gzip请求
为此,我想使用gzip(使用HTTP标头Content-Encoding: gzip
)压缩请求。在documentation中,提到参数play.ws.compressionEnabled
,但它似乎只启用WSResponse压缩。
我试图手动压缩有效负载(使用GZipOutputStream)并把标头Content-Encoding:gzip
,但服务器抛出io.netty.handler.codec.compression.DecompressionException : Unsupported compression method 191 in the GZIP header
。
我如何正确压缩我的请求?
在此先感谢
我觉得我读的地方,您可以配置WSClient使这一点,但还没有尝试过这样不是100% - 看'play.ws.compressionEnabled'为:https:// WWW .playframework.com /文档/ 2.5.X/javaws的#配置-WS – Nio