【问题标题】:How do I configure a filter in my web-app如何在我的网络应用程序中配置过滤器
【发布时间】:2017-07-18 03:18:19
【问题描述】:

我有一个服务于 index.html 和 bundle.js 文件的服务器(服务器:JBoss-EAP/7,X-Powered-By:Undertow/1)。我希望为我的开发环境关闭 bundle.js 文件的缓存,这样我就可以更新它而无需清除缓存。

我知道我通过向我的 web.xml 文件添加一个过滤器来做到这一点,但我不知道我应该使用什么倾斜器类。我怎样才能了解更多信息?

【问题讨论】:

    标签: wildfly undertow


    【解决方案1】:

    我认为在这种情况下您不需要配置过滤器。在 JBoss EAP undertow 子系统中有缓冲区缓存用于缓存静态资源。缓冲区缓存的默认大小为 10MB。

    <subsystem xmlns="urn:jboss:domain:undertow:3.1">
      <buffer-cache name="default"/>
      ....
    </subsystem>
    

    我认为您可以使用它并将缓存缓冲区大小更改为零,如下所示,或者即使我尚未验证,也可以删除缓冲区缓存。

    /subsystem=undertow/buffer-cache=default/:write-attribute(name=buffer-size,value=0)
    :reload
    

    您可以参考以下文档中的详细信息:

    1. https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/configuring_the_web_server_undertow#undertow-configure-buffer-caches
    2. https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/configuration_guide/reference_material#undertow-attribute-refs

    请注意,您也可以参考this 清除浏览器缓存。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-05
      • 2017-02-08
      • 2014-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多