private void checkIfContextIsFree(String path) {
   Handler[] handlers = _contextCollection.getChildHandlersByClass(ContextHandler.class);
   for (int i = 0; handlers != null && i < handlers.length; i++) {
     ContextHandler ctx = (ContextHandler) handlers[i];
     if (ctx.getContextPath().equals(path))
       throw new IllegalArgumentException("another context already bound to path " + path);
   }
 }
 @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);
 }
Exemple #3
0
 /** @since Jetty 6 */
 static ContextHandler getWebApp(String appName) {
   ContextHandlerCollection server = getConsoleServer();
   if (server == null) return null;
   Handler handlers[] = server.getHandlers();
   if (handlers == null) return null;
   String path = '/' + appName;
   for (int i = 0; i < handlers.length; i++) {
     ContextHandler ch = (ContextHandler) handlers[i];
     if (path.equals(ch.getContextPath())) return ch;
   }
   return null;
 }