use of org.mortbay.jetty.handler.ContextHandlerCollection in project gradle by gradle.
the class Jetty6PluginServer method configureHandlers.
/**
* Set up the handler structure to receive a webapp. Also put in a DefaultHandler so we get a nice page than a 404
* if we hit the root and the webapp's context isn't at root.
*/
public void configureHandlers() throws Exception {
this.defaultHandler = new DefaultHandler();
this.requestLogHandler = new RequestLogHandler();
if (this.requestLog != null) {
this.requestLogHandler.setRequestLog(this.requestLog);
}
this.contexts = (ContextHandlerCollection) server.getChildHandlerByClass(ContextHandlerCollection.class);
if (this.contexts == null) {
this.contexts = new ContextHandlerCollection();
this.handlers = (HandlerCollection) server.getChildHandlerByClass(HandlerCollection.class);
if (this.handlers == null) {
this.handlers = new HandlerCollection();
this.server.setHandler(handlers);
this.handlers.setHandlers(new Handler[] { this.contexts, this.defaultHandler, this.requestLogHandler });
} else {
this.handlers.addHandler(this.contexts);
}
}
}
Aggregations