Provide a metod to add handler at root, similar to builder.addHttpAccessLogAtRoot()
leifoolsen opened this issue · comments
I have created a small JAX-RS2 project using Jersey2 and the NetsOSS embedded-jetty builder.
I want to add functionality to stop Jetty via HTTP POST, as described here: org.eclipse.jetty.server.handler.ShutdownHandler. I can not see that there is an appropriate method in the builder to perform this.
The following method could be added to the EmbeddedJettyBuilder to achieve this:
public EmbeddedJettyBuilder addHandlerAtRoot(HandlerBuilder<Handler> handlerHandlerBuilder) {
handlers.add(handlerHandlerBuilder);
return this;
}
In my bootstrap code I can call:
builder.addHandlerAtRoot(new HandlerBuilder<Handler>(new ShutdownHandler("foo")));
I have downloaded a local copy of the snapshot and added the code snippet mentioned abode to verify that this actually works.
It may be that I have overlooked something and that this is already possible in the existing code.