gpt4 book ai didi

java - Spring 启动 Web 应用程序 : compression is not applying

转载 作者:搜寻专家 更新时间:2023-11-01 03:49:50 25 4
gpt4 key购买 nike

不适用于非@ResponseBody 注释的方法。我误解了什么吗?根本原因可能是什么?

应用于@ResponseBody 方法的压缩:

@RequestMapping(value = "/property/{id}/pano.xml", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public String getPanoXml(@PathVariable("id") Property property) {
return assetsProvider.loadUnderlyingObject(property.getPanoXml()).getObject();
}

gzipped

压缩不应用于非@ResponseBody 方法:

@RequestMapping(value = "/property/{id}", method = RequestMethod.GET)
public String get(Model model, @PathVariable Long id, Locale locale) throws NoSuchRequestHandlingMethodException {
LocalizedProperty lp = repository.findProperty(id, locale.getLanguage());
// TODO: replace with custom exception
if (lp == null)
throw new NoSuchRequestHandlingMethodException("get", PropertiesController.class);
model.addAttribute(lp);

return "property/show";
}

not gzipped

库版本和配置:

Spring Boot 版本:1.2.4.RELEASE
View 渲染器:Thymeleaf

应用配置:

server:
tomcat:
compression: "1024"
compressableMimeTypes: "application/json,application/xml,text/html,text/xml,text/plain"

最佳答案

正如 Roman 回答的(在对问题的评论中),企业防病毒软件正在修改传入流量,以便解压缩所有响应。

关于java - Spring 启动 Web 应用程序 : compression is not applying,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31562729/

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