handler.initialize();
    public synchronized Object createContext(String strUrl,                                                      HttpProcessor processor) throws Exception {        URL url = new URL(strUrl);        Server server = getServer(url);        if (server == null) {            server = createServer(url, processor.getSsl());        } else {            // Check ssl params            SslParameters ssl = (SslParameters) sslParams.get(getKey(url));            if (ssl != null && !ssl.equals(processor.getSsl())) {                throw new Exception("An https server is already created on port " + url.getPort() + " but SSL parameters do not match");            }        }        String path = url.getPath();        if (!path.startsWith("/")) {            path = "/" + path;        }        if (path.endsWith("/")) {            path = path.substring(0, path.length() - 1);        }        String pathSlash = path + "/";        // Check that context does not exist yet        HandlerCollection handlerCollection = (HandlerCollection) server.getHandler();        ContextHandlerCollection contexts = (ContextHandlerCollection) handlerCollection.getHandlers()[0];        Handler[] handlers = contexts.getHandlers();        if (handlers != null) {            for (int i = 0; i < handlers.length; i++) {                if (handlers[i] instanceof ContextHandler) {                    ContextHandler h = (ContextHandler) handlers[i];                    String handlerPath = h.getContextPath() + "/";                    if (handlerPath.startsWith(pathSlash) ||                        pathSlash.startsWith(handlerPath)) {                        throw new Exception("The requested context for path '" + path + "' overlaps with an existing context for path: '" + h.getContextPath() + "'");                    }                }            }        }        // Create context        ContextHandler context = new ContextHandler();        context.setContextPath(path);        ServletHolder holder = new ServletHolder();        holder.setName("jbiServlet");        holder.setClassName(HttpBridgeServlet.class.getName());        ServletHandler handler = new ServletHandler();        handler.setServlets(new ServletHolder[] { holder });        ServletMapping mapping = new ServletMapping();        mapping.setServletName("jbiServlet");        mapping.setPathSpec("/*");        handler.setServletMappings(new ServletMapping[] { mapping });        if (processor.getAuthMethod() != null) {            SecurityHandler secHandler = new SecurityHandler();            ConstraintMapping constraintMapping = new ConstraintMapping();            Constraint constraint = new Constraint();            constraint.setAuthenticate(true);            constraint.setRoles(new String[] { "*" });            constraintMapping.setConstraint(constraint);            constraintMapping.setPathSpec("/");            secHandler.setConstraintMappings(new ConstraintMapping[] { constraintMapping });            secHandler.setHandler(handler);            secHandler.setAuthMethod(processor.getAuthMethod());            secHandler.setUserRealm(new JaasUserRealm());            context.setHandler(secHandler);        } else {            context.setHandler(handler);        }        context.setAttribute("processor", processor);        // add context        contexts.addHandler(context);        context.start();        return context;    }