@Override
 public void removeContext(String path) throws IllegalArgumentException {
   Handler handler = null;
   Handler[] handlers = _contextCollection.getChildHandlersByClass(ContextHandler.class);
   for (int i = 0; handlers != null && i < handlers.length && handler == null; i++) {
     ContextHandler ctx = (ContextHandler) handlers[i];
     if (ctx.getContextPath().equals(path)) handler = ctx;
   }
   if (handler != null) _contextCollection.removeHandler(handler);
 }
Esempio n. 2
0
 /**
  * stop it and remove the context
  *
  * @throws just about anything, caller would be wise to catch Throwable
  */
 static void stopWebApp(String appName) {
   ContextHandler wac = getWebApp(appName);
   if (wac == null) return;
   try {
     // not graceful is default in Jetty 6?
     wac.stop();
   } catch (Exception ie) {
   }
   ContextHandlerCollection server = getConsoleServer();
   if (server == null) return;
   try {
     server.removeHandler(wac);
     server.mapContexts();
   } catch (IllegalStateException ise) {
   }
 }