简体   繁体   English

DebugHandler在最新的Jetty版本中有描述,如何正确关闭?

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

Example of how to enable an shutdownhandler for Embedded Jetty 如何为嵌入式码头启用shutdownhandler处理程序的示例

when I try to use it with a newer Jetty Version I get deprecated warnings. 当我尝试将其与newer Jetty Version一起使用时,会收到不赞成使用的警告。

What would be the proper way to Implement a shutdown handler for the latest Jetty version ? 为最新的Jetty版本实现关闭处理程序的正确方法是什么?

[Edit] [编辑]

tried to add shutdown functionality with. 试图添加关机功能。 ShutdownHandler shutdownHandler = new ShutdownHandler("switchoff", true, true); ShutdownHandler shutdownHandler =新的ShutdownHandler(“ switchoff”,true,true);

but got 404 with http://localhost:22279/shutdown?token= "switchoff" 但通过http:// localhost:22279 / shutdown?token = “ 404”获得了404

Welcome Page does work with http://localhost:22279/ 欢迎页面确实适用于http:// localhost:22279 /

DebugHandler is not necessary for shutdown. DebugHandler关闭DebugHandler

If you are using embedded jetty, you can just keep a reference to the Server object and call Server.stop() when you want it to shut down. 如果使用嵌入式码头,则可以保留对Server对象的引用,并在需要关闭时调用Server.stop()

otherwise ... 除此以外 ...

The ShutdownHandler can still be used, it has not been disabled or deprecated. ShutdownHandler仍可以使用,尚未禁用或不建议使用。

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

The javadoc even has a snippet that shows its use. Javadoc甚至有一个片段来显示其用法。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM