在 wildfly-8.2 中允许 G zip 压缩。0.Final
Allow G zip compression in wildfly-8.2.0.Final
我是 运行 我在 wildfly-8.2 上的 java 项目。0.Final,我想为网络内容启用 G-zip 压缩(js,css,jsp等),如何实现.
我搞定了,我们需要像这样更改 standalone.xml
搜索然后进行如下更改
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
**<filter-ref name="gzipFilter" predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?', value=%{o,Content-Type}, full-match=true]"/>**
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
**<gzip name="gzipFilter"/>**
</filters>
</subsystem>
(粗体字是变化)
我是 运行 我在 wildfly-8.2 上的 java 项目。0.Final,我想为网络内容启用 G-zip 压缩(js,css,jsp等),如何实现.
我搞定了,我们需要像这样更改 standalone.xml 搜索然后进行如下更改
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
**<filter-ref name="gzipFilter" predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?', value=%{o,Content-Type}, full-match=true]"/>**
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
**<gzip name="gzipFilter"/>**
</filters>
</subsystem>
(粗体字是变化)