How to enable GZIP for RestController?
If you are using Spring boot and Tomcat You should be able to accomplish this via Tomcat Configuration:
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#how-to-enable-http-response-compression
Here is a similar POST Using GZIP compression with Spring Boot/MVC/JavaConfig with RESTful
It's as simple as follows:
server.compression.enabled=true
server.compression.mime-types=application/xml
Compression is not working in spring but, it is showing Content-Encoding as gzip in the response headers
This might be the issue when we test with postman, as asked here, so inorder to verify, i tried with chrome and i got the compressed size(transfered over network) and also the actual size which is displayed as (resource size), along with the header "Content-Encoding" as "gzip".
Spring-boot enable compression for non-embedded containers
It is not possible without any extra configuration. The spring-boot configuration works for the embedded containers.
Related Topics
Jtable Model Listener Detects Inserted Rows Too Soon (Before They Are Drawn)
How to Write Logs in Text File When Using Java.Util.Logging.Logger
Is a Java Array of Primitives Stored in Stack or Heap
Persistencecontext Entitymanager Injection Nullpointerexception
What Is the Point of Overloaded Convenience Factory Methods for Collections in Java 9
How to Get Information About the Local Variables Using Java Reflection
Difference Between @Valid and @Validated in Spring
Convert JSON String to Pretty Print JSON Output Using Jackson
Convert Escaped Unicode Character Back to Actual Character
Autocomplete with Java , Redis, Elastic Search , Mongo
Jpa: How to Have One-To-Many Relation of the Same Entity Type
How to Redirect to Login Page When Session Is Expired in Java Web Application
Where Do Java and .Net String Literals Reside
Reverse Each Individual Word of "Hello World" String with Java