gpt4 book ai didi

spring - 使用 gzip 压缩 rest 响应

转载 作者:行者123 更新时间:2023-12-01 09:55:16 24 4
gpt4 key购买 nike

我有一个向最终用户公开的休息服务。此服务发送响应(比如 500K)并且响应时间很长。

我们如何使用 Gzip 压缩响应并发送。

我正在使用 Spring boot 和 maven。

提前致谢。

最佳答案

GZIP 配置已在 Spring Boot 版本 1.3 中更新。现在,正确的处理方式是使用 server.compression.enabled 属性。

server.compression.enabled=true

参见 Enable HTTP response compression有关配置详细信息(例如响应大小和内容类型)的引用文档中的章节。请阅读Release Notes对于这种变化的动机。

关于spring - 使用 gzip 压缩 rest 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29523068/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com