How do I enable gzip for restcontroller?
•
Java
See English answers > using gzip compression with spring boot / MVC / javaconfig with restful 8
@RestController public class MyRest { @RequestMapping(method = RequestMethod.GET,produces = MediaType.APPLICATION_XML_VALUE) @ResponseBody public ComplexRsp test() { //... } }
When using soap WSDL method, there will be a simple @ gzip annotation on the service class How do you achieve the same goal for rest?
Solution
If you are using spring to launch and tomcat, you should be able to do this through Tomcat configuration:
This is a similar post using gzip compression with spring boot / MVC / javaconfig with restful
It is simple as follows:
server.compression.enabled=true server.compression.mime-types=application/xml
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码