我正在使用Spring编写一个简单的REST
控制器。
如何启用返回的application/xml
流的GZIP响应?
@RestController
public class MyRest {
@RequestMapping(method = RequestMethod.GET,
produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public ComplexRsp test() {
//...
}
}
使用 soap+wsdl 方法时,服务类上会有简单的 @GZIP
注解。那么我该如何在 REST 中实现同样的效果呢?