Configure the ZK Loader Not to Compress the Output

By default, the output of the ZK loader and filter is compressed, if the browser supports the content compression[59] (and the output is not included by other Servlets). By compressing the output, the transmission time over a slow Internet connection is reduced dramatically.

However, if you want to use a filter to post-process the output, the compression may not be applicable. In this case, you can disable it by specifying the compress parameter (init-param) to be true, when configuring the ZK loader in WEB-INF/web.xml as follows.

<servlet>
    <servlet-name>zkLoader</servlet-name>    
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>    
    <init-param>    
        <param-name>update-uri</param-name>        
        <param-value>/zkau</param-value>        
    </init-param>    
    <init-param>    
        <param-name>compress</param-name>        
        <param-value>false</param-value>        
    </init-param>    
</servlet>

Notice: you can configure multiple ZK loader in one Web application. Each of them with a different options.

<servlet>
    <servlet-name>zkLoader1</servlet-name>    
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>    
...
</servlet>
<servlet>
    <servlet-name>zkLoader2</servlet-name>    
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>    
...
</servlet>

Similarly, you can configure the ZK filter (org.zkoss.zk.ui.http.DHtmlLayoutFilter) not to compress the output, too.

<filter>
    <filter-name>zkFilter</filter-name>    
    <filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>    
    <init-param>    
        <param-name>extension</param-name>        
        <param-value>html</param-value>        
    </init-param>    

<init-param>

<param-name>compress</param-name>

<param-value>false</param-value>

</init-param>

</filter>


[59] Refer to 14.3 Accept-Encoding in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html