Want to enable GZip compression in Weblogic

馋奶兔 提交于 2019-12-18 16:54:52

问题


I want to enable GZIP compression for my static file like css styles, javascript which is serving from weblogic server. Can anyone help to how to configure this feature in weblogic server.


回答1:


Go to http://sourceforge.net/projects/pjl-comp-filter/ to download it and update your web.xml file with the following config:

<filter>
    <filter-name>CompressingFilter</filter-name>
    <filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
    <init-param><param-name>includeContentTypes</param-name><param-value>text/html,text/css,application/x-javascript</param-value></init-param>
    <init-param><param-name>compressionThreshold</param-name><param-value>256</param-value></init-param>
</filter>

<filter-mapping>
    <filter-name>CompressingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>



回答2:


Configure GZIP compression for Web applications

You can enable and configure content-encoding GZIP compression at the domain level or Web application level. Values for a specific Web application override domain-level values. To configure GZIP compression for all Web applications in the domain:

  1. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
  2. In the Domain Structure tree, select your domain.
  3. Select Configuration > Web Applications.
  4. Define the following domain-wide Web application configuration settings for GZIP compression:
    • GZIP Compression Enabled: enable or disable GZIP compression for all Web applications. By default, this value is not enabled.
    • GZIP Compression Min. Content Length: configure the minimum content length to trigger GZIP compression. The default value is 2048.
    • GZIP Compression Content Type: configure the type of content to be included in compression. The default value is text/html, text/xml, text/plain. Click Save to save any changes.
  5. To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
    Not all changes take effect immediately—some require a restart (see Use the Change Center).


来源:https://stackoverflow.com/questions/8742883/want-to-enable-gzip-compression-in-weblogic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!