mem*_*und 3 java rest spring gzip spring-boot
我有一个简单的REST控制器使用spring.如何application/xml启用返回流的GZIP响应?
@RestController
public class MyRest {
@RequestMapping(method = RequestMethod.GET,
produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public ComplexRsp test() {
//...
}
}
Run Code Online (Sandbox Code Playgroud)
使用soap + wsdl方法时,@GZIP服务类上会有简单的注释.如何为REST实现相同的目标?
小智 11
如果您正在使用Spring启动和Tomcat您应该能够通过Tomcat配置完成此任务:http: //docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#how-to-enable- HTTP的响应压缩
这是一个类似的POST 使用GZIP压缩与Spring Boot/MVC/JavaConfig与RESTful
它很简单如下:
server.compression.enabled=true
server.compression.mime-types=application/xml
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23178 次 |
| 最近记录: |