Debug Handler Deprecated in latest Jetty Version,如何正确关闭?

DebugHandler Depricated in latest Jetty Version, how to properly shutdown?

Example 如何为嵌入式 Jetty

启用 shutdownhandler

当我尝试将它与 newer Jetty Version 一起使用时,我收到了弃用警告。

为最新的 Jetty 版本实施关闭处理程序的正确方法是什么?

[编辑]

尝试添加关机功能。 ShutdownHandler shutdownHandler = new ShutdownHandler("switchoff", true, 真);

但是得到了 404 http://localhost:22279/shutdown?token="switchoff"

欢迎页面确实适用于 http://localhost:22279/

DebugHandler 不需要关机。

如果您使用的是嵌入式码头,您可以只保留对 Server 对象的引用,并在您希望它关闭时调用 Server.stop()

否则...

ShutdownHandler 仍然可以使用,它没有被禁用或弃用。

org/eclipse/jetty/server/handler/ShutdownHandler.java

javadoc 甚至有一段显示其用法的片段。

API Docs: org.eclipse.jetty.server.handler.ShutdownHandler