处理 Lagom 服务响应的压缩

Handle compression of Lagom's service responses

根据这个Lagom doc进行序列化:

Compression, as described here, is only used for persistent events, persistent snapshots and remote messages with the service cluster. It is not used for messages that are serialized in the external API of the service.

我想允许处理请求 headers,例如

Accept-Encoding: gzip, deflate, sdch, br

那么,处理 Lagom 服务生成的对外部应用程序的响应压缩的方法是什么? Web-App?

您是想在服务调用中实际处理这个问题,还是想在更高级别进行一般性处理?如果你想在更高层次上处理它,那么你需要做的就是启用 Play 的 gzip 过滤器:

https://www.playframework.com/documentation/2.6.x/GzipEncoding

目前仅支持gzip,但可以修改以支持其他压缩编码。