use of org.eclipse.jetty.server.HandlerContainer in project jetty.project by eclipse.
the class HandlerCollection method setHandlers.
/* ------------------------------------------------------------ */
/**
* @param handlers The handlers to set.
*/
public void setHandlers(Handler[] handlers) {
if (!_mutableWhenRunning && isStarted())
throw new IllegalStateException(STARTED);
if (handlers != null) {
// check for loops
for (Handler handler : handlers) if (handler == this || (handler instanceof HandlerContainer && Arrays.asList(((HandlerContainer) handler).getChildHandlers()).contains(this)))
throw new IllegalStateException("setHandler loop");
// Set server
for (Handler handler : handlers) if (handler.getServer() != getServer())
handler.setServer(getServer());
}
Handler[] old = _handlers;
;
_handlers = handlers;
updateBeans(old, handlers);
}
use of org.eclipse.jetty.server.HandlerContainer in project jetty.project by eclipse.
the class HandlerWrapper method setHandler.
/* ------------------------------------------------------------ */
/**
* @param handler Set the {@link Handler} which should be wrapped.
*/
public void setHandler(Handler handler) {
if (isStarted())
throw new IllegalStateException(STARTED);
// check for loops
if (handler == this || (handler instanceof HandlerContainer && Arrays.asList(((HandlerContainer) handler).getChildHandlers()).contains(this)))
throw new IllegalStateException("setHandler loop");
if (handler != null)
handler.setServer(getServer());
Handler old = _handler;
_handler = handler;
updateBean(old, _handler, true);
}
Aggregations