java – Spring Boot Webapp:压缩不适用
发布时间:2020-12-15 02:08:07 所属栏目:Java 来源:网络整理
导读:不使用非@ ResponseBody注释方法.我误解了什么吗?可能是根本原因? 压缩应用于@ResponseBody方法: @RequestMapping(value = "/property/{id}/pano.xml",method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE)@ResponseBodypublic Strin
不使用非@ 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(); } 压缩不适用于非@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"; } Lib版本和配置: Spring Boot版本:1.2.4.RELEASE 应用配置: server: tomcat: compression: "1024" compressableMimeTypes: "application/json,application/xml,text/html,text/xml,text/plain" 解决方法
罗马回答(在评论中提问),企业反病毒软件正在修改传入的流量,以便所有响应都被解压缩.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- java集合中的list详解
- java – netbeans 8.0.2 – 无法正确打印utf-8字
- Android 判断 网络连接 Internet访问 工具类
- java – ExecutorService.Submit(Callable)为Fut
- java – 谷歌地图v2 Projection.toScreenLocatio
- WASM(WebAssember)快速了解第一篇——什么是We
- symfony – @UniqueConstraint和@Column(unique
- orm – 主键 – Native,Sequence或GUID键?
- java – Spring Boot安全性在登录失败后显示Http
- java countDownLatch 线程辅助类
热点阅读