【问题标题】:Configuring jetty at start up to not scan jar files and speed up deployment.在启动时配置 jetty 不扫描 jar 文件并加快部署。
【发布时间】:2014-02-03 21:53:17
【问题描述】:

我正在开发一个嵌入式码头网络应用程序,我们从 jar 文件启动应用程序,并且我们希望防止在启动时发生的类路径扫描会减慢启动过程。

这里的 Eclipse 文档中概述了使用 xml 的方法:

http://wiki.eclipse.org/Jetty/Howto/Avoid_slow_deployment

在那个页面上它说,“在代码中通过调用......”

我已经查看了来自 WebAppContext 的 API,关于如何配置上下文以不执行此操作的内容不多,但基于以下声明:

"可以为单个 webapp 设置上下文属性"

我尝试了以下方法:

 WebAppContext servletContext = new WebAppContext();
 servletContext.setAttribute("org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern", "^$");

但是,这似乎不起作用。有没有人有一个有效的解决方案来配置 webappcontext 以便它不扫描那些 jar 文件?

【问题讨论】:

    标签: jetty


    【解决方案1】:

    也许改用removeAttribute()

    WebAppContext servletContext = new WebAppContext();
    servletContext.removeAttribute("org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-27
      • 1970-01-01
      • 1970-01-01
      • 2015-01-11
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多