Enabling gZip Compression using tomcat-maven plugin
In our spring application, we want to compress the response using gzip compression, from the documentation i found out that we can configure it by modifying /conf/server.xml file in tomcat (http://www.servletworld.com/tomcat/enable-tomcat-gzip-compression.html).
But in our app, we are using embedded tomcat from org.codehaus.mojo plugin, From some research, i can see that we开发者_如何转开发 can do such server configurations in pom.xml as below :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<port>${tomcat.port}</port>
<url>${tomcat.manager}</url>
<username>${tomcat.manager.username}</username>
<password>${tomcat.manager.password}</password>
</configuration>
</plugin>
Similarly i wanted to configure the connector attributes for enabling compression, tried out different ways but with no success.
Can someone please help me out.
Thanks
Shri
It does not look like maven tomcat plugin allows you to do this, but tomcat:run goal seems to provide a serverXml
parameter, using which you can specify your own server.xml
with compression attributes enabled.
精彩评论