Activate gzip support on Apache Meecrowave in 5s
If you use Apache Meecrowave to host a Java server and serve some static resources (like a SPA) then you will likely want to activate GZIP support on the Tomcat connector.
Since Meecrowave is highly pluggable you can do it programmatically but did you know you can just do it by configuration?
The first step is to create a meecrowave.properties file in your classpath (if you have a Maven/Gradle project just put it in src/main/resources) and then configure your connector to activate the compression by putting the following line in the file:
connector.attributes.compression = on
Restart, and here it is. The prefix connector.attributes allows to set any property on the connector instance.
The last tip is you can pass a meecrowave.properties file to Meecrowave CLI directly without having to put it in your classpath. This allows you to tune finely the server (from the connector, to the access log) without having to modify the application.
Happy serving ;).
From the same author:
In the same category: