Since Jetty 7.5.x you can use org.eclipse.jetty.server.handler.ShutdownHandlerin your code:
Server server = new Server(8080);
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[]
{ someOtherHandler, new ShutdownHandler("secret_password", false, true) });
server.setHandler(handlers);
server.start();
... which will allow you to close your berth by sending the following http POST request:
curl -X POST http://localhost:8080/shutdown?token=secret_password
source
share