private void addServletsToContext(ServletContextHandler context)
     throws InstantiationException, IllegalAccessException, ClassNotFoundException, Exception {
   synchronized (servletSpecs) {
     Iterator<ServletSpec> servletsIter = servletSpecs.iterator();
     while (servletsIter.hasNext()) {
       ServletSpec spec = servletsIter.next();
       addServletToContext(context, spec);
     }
   }
 }
  private void addServlet(ServletSpec spec) {
    synchronized (servletSpecs) {
      servletSpecs.add(spec);
      try {
        // TODO make sure context has appropriate settings
        // servletContext.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(name)

        addServletToContext(servletContext, spec);
      } catch (Exception ex) {
        logger.log(Level.INFO, "Could not add servlet", ex);
        lifeCycleControlConduit.vote(meemContext.getWedgeIdentifier(), false);
        return;
      }
    }
  }
  protected void stopServer() {
    if (server != null) {
      try {
        server.stop();
        server = null;
      } catch (Exception ex) {
        logger.log(Level.INFO, "A problem occurred when stopping the server", ex);
      }
    }
    handlerCollection = null;
    servletContext = null;

    servletSpecs.clear();
    resourceSpecs.clear();
  }