【问题标题】:Want to enable GZip compression in Weblogic想要在 Weblogic 中启用 GZip 压缩
【发布时间】:2012-02-03 07:11:51
【问题描述】:

我想为我的静态文件启用 GZIP 压缩,例如从 weblogic 服务器提供的 css 样式、javascript。任何人都可以帮助如何在 weblogic 服务器中配置此功能。

【问题讨论】:

    标签: compression webserver weblogic


    【解决方案1】:

    为 Web 应用程序配置 GZIP 压缩

    您可以在域级别或 Web 应用程序级别启用和配置内容编码 GZIP 压缩。特定 Web 应用程序的值会覆盖域级别的值。 为域中的所有 Web 应用程序配置 GZIP 压缩:

    1. 如果您还没有这样做,请在 管理控制台,单击锁定和编辑 (see Use the Change Center)。
    2. 在域结构树中,选择您的域。
    3. 选择配置 > Web 应用程序
    4. 为以下域范围的 Web 应用程序配置设置定义 GZIP 压缩:
      • 启用 GZIP 压缩:启用或禁用所有 Web 应用程序的 GZIP 压缩。默认情况下,此值未启用。
      • GZIP 压缩最小值。内容长度:配置触发GZIP压缩的最小内容长度。默认值为 2048。
      • GZIP 压缩内容类型:配置要包含在压缩中的内容类型。默认值为 text/html、text/xml、text/plain。单击保存以保存任何更改。
    5. 要激活这些更改,请在管理控制台的更改中心单击激活更改
      并非所有更改都会立即生效——有些更改需要重新启动 (see Use the Change Center)。

    【讨论】:

    • 我使用的额外内容类型包括默认值:text/html text/xml text/plain text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
    【解决方案2】:

    转到http://sourceforge.net/projects/pjl-comp-filter/ 下载它并使用以下配置更新您的 web.xml 文件:

    <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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-28
      • 2013-12-29
      • 2014-09-26
      • 1970-01-01
      • 2013-05-05
      • 2011-10-11
      • 1970-01-01
      • 2011-02-28
      相关资源
      最近更新 更多