Here's where Undertow is being rebuild at {@link Undertow} level (not {@link ServletContainer} level).
This is were <em>global</em> objects are configured (listeners, global filters, ...)
975520
private void doConfigure() {
        Undertow.Builder builder = Undertow.builder();

        // if no configuration method change root handler, simple path->HttpHandler will be used
        // where each HttpHandler is created in separate org.ops4j.pax.web.service.undertow.internal.Context
        HttpHandler rootHandler = path;

        URL undertowResource = detectUndertowConfiguration();
        ConfigSource source = ConfigSource.kind(undertowResource);

        switch (source) {
            case XML:
                LOG.info("Using \"" + undertowResource + "\" to configure Undertow");
                rootHandler = configureUndertow(configuration, builder, rootHandler, undertowResource);
                break;
            case PROPERTIES:
                LOG.info("Using \"" + undertowResource + "\" to read additional configuration for Undertow");
                configureIdentityManager(undertowResource);
                // do not break - go to standard PID configuration
            case PID:
                LOG.info("Using \"org.ops4j.pax.url.web\" PID to configure Undertow");
                rootHandler = configureUndertow(configuration, builder, rootHandler);
                break;
        }

        for (Context context : contextMap.values()) {
            try {
                context.setSessionPersistenceManager(sessionPersistenceManager);
                context.setDefaultSessionTimeoutInMinutes(defaultSessionTimeoutInMinutes);
                context.start();
            } catch (Exception e) {
                LOG.error("Could not start the servlet context for context path [" + context.getContextModel().getContextName() + "]", e);
            }
        }

        builder.setHandler(rootHandler);
        server = builder.build();
    }
1232948
protected void initServlet(XmlParser.Node node) throws ClassNotFoundException,UnavailableException,IOException,
            MalformedURLException
    {
        String name=node.getString("servlet-name",false,true);
        String className=node.getString("servlet-class",false,true);
        String jspFile=null;
        Holder template=null;
        if(className==null)
        {
            // There is no class, so look for a jsp file
            jspFile=node.getString("jsp-file",false,true);
            if(jspFile!=null)
            {
                Map.Entry entry=getWebApplicationHandler().getHolderEntry(jspFile);
                if(entry!=null)
                {
                    template = (Holder)entry.getValue();
                    className=template.getClassName();  
                }
            }
            if(className==null)
            {
                log.warn("Missing servlet-class|jsp-file in "+node);
                return;
            }
        }
        if(name==null)
            name=className;
        ServletHolder holder=getWebApplicationHandler().newServletHolder(name,className,jspFile);

        // handle JSP configuration
        if(jspFile!=null)
        {
            Enumeration e=template.getInitParameterNames();
            
            while(e.hasMoreElements())
            {   
                String p=(String)e.nextElement();
                holder.setInitParameter(p, template.getInitParameter(p));
            }
            if (holder.getInitParameter("classpath")==null)
                holder.setInitParameter("classpath",getWebApplicationContext().getFileClassPath());
        }
       
        // handle init params
        Iterator iParamsIter=node.iterator("init-param");
        while(iParamsIter.hasNext())
        {
            XmlParser.Node paramNode=(XmlParser.Node)iParamsIter.next();
            String pname=paramNode.getString("param-name",false,true);
            String pvalue=paramNode.getString("param-value",false,true);
            holder.put(pname,pvalue);
        }
        XmlParser.Node startup=node.get("load-on-startup");
        if(startup!=null)
        {
            String s=startup.toString(false,true).toLowerCase();
            if(s.startsWith("t"))
            {
                log.warn("Deprecated boolean load-on-startup.  Please use integer");
                holder.setInitOrder(1);
            }
            else
            {
                int order=0;
                try
                {
                    if(s!=null&&s.trim().length()>0)
                        order=Integer.parseInt(s);
                }
                catch(Exception e)
                {
                    log.warn("Cannot parse load-on-startup "+s+". Please use integer");
                    LogSupport.ignore(log,e);
                }
                holder.setInitOrder(order);
            }
        }
        Iterator sRefsIter=node.iterator("security-role-ref");
        while(sRefsIter.hasNext())
        {
            XmlParser.Node securityRef=(XmlParser.Node)sRefsIter.next();
            String roleName=securityRef.getString("role-name",false,true);
            String roleLink=securityRef.getString("role-link",false,true);
            if(roleName!=null&&roleName.length()>0&&roleLink!=null&&roleLink.length()>0)
            {
                if(log.isDebugEnabled())
                    log.debug("link role "+roleName+" to "+roleLink+" for "+this);
                holder.setUserRoleLink(roleName,roleLink);
            }
            else
            {
                log.warn("Ignored invalid security-role-ref element: "+"servlet-name="+name+", "+securityRef);
            }
        }
        XmlParser.Node run_as=node.get("run-as");
        if(run_as!=null)
        {
            String roleName=run_as.getString("role-name",false,true);
            if(roleName!=null)
                holder.setRunAs(roleName);
        }
    }
1027168
@PostConstruct
    @SuppressWarnings("checkstyle:emptycatchblock")
    void excludeLoggers() {
        try {
            // Exclude Tomcat logger when processing HTTP requests via a servlet.
            // Regex specified to match the servlet variable parts of the logger name, e.g.
            // the Spring Boot default is:
            // [Tomcat].[localhost].[/].[dispatcherServlet]
            // but could be something like:
            // [Tomcat-1].[127.0.0.1].[/subdomain/].[customDispatcher]
            BugsnagAppender.addExcludedLoggerPattern("org.apache.catalina.core.ContainerBase."
                    + "\\[Tomcat.*\\][.]\\[.*\\][.]\\[/.*\\][.]\\[.*\\]");

            // Exclude Jetty logger when processing HTTP requests via the HttpChannel
            BugsnagAppender.addExcludedLoggerPattern("org.eclipse.jetty.server.HttpChannel");

            // Exclude Undertow logger when processing HTTP requests
            BugsnagAppender.addExcludedLoggerPattern("io.undertow.request");
        } catch (NoClassDefFoundError ignored) {
            // logback was not in classpath, ignore throwable to allow further initialisation
        }
    }
1036344
@Override
	public int doStartTag() throws JspException {

		HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

		if (null == pageContext.getServletContext().getAttribute(getResourceHandlerAttributeName()))
			throw new IllegalStateException(
					"ResourceBundlesHandler not present in servlet context. Initialization of Jawr either failed or never occurred.");

		ResourceBundlesHandler rsHandler = (ResourceBundlesHandler) pageContext.getServletContext()
				.getAttribute(getResourceHandlerAttributeName());
		JawrConfig jawrConfig = rsHandler.getConfig();

		if (RendererRequestUtils.refreshConfigIfNeeded(request, jawrConfig)) {
			rsHandler = (ResourceBundlesHandler) pageContext.getServletContext()
					.getAttribute(getResourceHandlerAttributeName());
			jawrConfig = rsHandler.getConfig();
		}

		Boolean useRandomFlag = null;
		if (StringUtils.isNotEmpty(useRandomParam)) {
			useRandomFlag = Boolean.valueOf(useRandomParam);
		}
		// Renderer istance which takes care of generating the response
		BundleRenderer renderer = createRenderer(rsHandler, useRandomFlag);

		// set the debug override
		RendererRequestUtils.setRequestDebuggable(request, jawrConfig);

		try {
			BundleRendererContext ctx = RendererRequestUtils.getBundleRendererContext(request, renderer);
			renderer.renderBundleLinks(src, ctx, pageContext.getOut());

		} catch (IOException ex) {
			throw new JspException("Unexpected IOException when writing script tags for path " + src, ex);
		} finally {
			// Reset the Thread local for the Jawr context
			ThreadLocalJawrContext.reset();
		}

		return SKIP_BODY;
	}
225542
@Override
    public void onStart(ITestContext context) {
        logger.entering(context);
        if (ListenerManager.isCurrentMethodSkipped(this)) {
            logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG);
            return;
        }

        String testName = context.getCurrentXmlTest().getName();
        // initializing the ConfigSummaryData before initializers so that config details can be added.
        ConfigSummaryData.initLocalConfigSummary(testName);

        // We have to ensure that our configuration is the first thing that gets loaded.
        // Our loading mechanism is going to be via listeners. But the problem with TestNG listeners is
        // that the order of loading is never guaranteed. Things become complicated if our downstream consumers
        // want to piggy back on our configuration and want to have their configurations loaded as well.
        // Because of all these issues, we cannot rely on building a config specific listener.
        // So we are relying on the ServiceLoaders in Java to do it for us. The moment we are here, we ensure that
        // not only the SeLion specific configurations are loaded, but all downstream consumer's configurations
        // are loaded as well along with us. So SeLion now becomes the single point of initialization and thus
        // does away with all the inherent setbacks that are associated with TestNG listeners orders.
        invokeInitializersBasedOnPriority(context);

        ConfigManager.printConfiguration(testName);

        ISuite suite = context.getSuite();

        if (!suite.getParallel().equals("false") && logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "Parallel suite execution. Updating SeLion local config for Test, "
                    + context.getCurrentXmlTest().getName());
        }

        String base = suite.getOutputDirectory();
        String suiteName = suite.getName();
        String rootFolder = filterOutputDirectory(base, suiteName);
        SeLionReporter.setTestNGOutputFolder(rootFolder);
        SeLionReporter.init();
        logger.exiting();
    }
14241
@Override
    public void doFilterWriteListeners(final long sessionId, final long sessionWrittenBytes, final WriteRequest writeRequest) {
        runManagementTask(new Runnable() {
            @Override
            public void run() {
                try {
                    // The particular management listeners change on strategy, so get them here.
                    for (final GatewayManagementListener listener : getManagementListeners()) {
                        listener.doFilterWrite(GatewayManagementBeanImpl.this, sessionId);
                    }

                    markChanged();  // mark ourselves as changed, possibly tell listeners
                } catch (Exception ex) {
                    logger.warn("Error during filterWrite gateway listener notifications:", ex);
                }
            }
        });
    }
111267
private void rebuild()
    {
        pollact = null;

        pollSize = pollers.size();
        if (pollset != null) {
            pollset.close();
        }
        pollset = context.poller(pollSize);
        assert (pollset != null);

        pollact = new SPoller[pollSize];

        int itemNbr = 0;
        for (SPoller poller : pollers) {
            pollset.register(poller.item);
            pollact[itemNbr] = poller;
            itemNbr++;
        }
        dirty = false;
    }
81202
public void reconstituteSourceStreams(DestinationHandler dest, PtoPOutputHandler outputHandler, int startMode) 
  
  throws MessageStoreException, SIDiscriminatorSyntaxException, SIErrorException, SIResourceException
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "reconstituteSourceStreams", new Integer(startMode));

    
    /*
     * Iterate through all contained Protocol Items, looking for StreamSet
     * associated with source. Note that outputHandler passed in is null if this 
     * is Pubsub. 
     */ 
     
    SourceStreamSetFilter filter = null;
    if( dest.isPubSub())
    { 
      filter = new SourceStreamSetFilter(null);
    }
    else
    {
      filter = new SourceStreamSetFilter(outputHandler.getTargetMEUuid());
    }
    
    NonLockingCursor cursor = null;
    
    try
    {
      cursor = newNonLockingItemCursor(filter);    
           
	    AbstractItem item = null;
	    
	    //should only be one match!!
	    while (null != (item = cursor.next()))
	    {
	      StreamSet streamSet = (StreamSet)item;
          streamSet.initializeNonPersistent(dest.getTxManager());
	      
	      // Don't do flush if we are asked to start in recovery mode 
	      if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	         && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	      {
	        // Log message to console saying we have started flush for this steamSet
	        // parmeters are:- ME name, streamSet Uuid, destinationName
	        SibTr.info(
	          tc,
	          "FLUSH_INITIATED_MESSAGE_CWSIP0781",
	          new Object[] { dest.getMessageProcessor().getMessagingEngineName(),
	                        streamSet.getStreamID(),
	                        dest.getName() });
	      }
	      try
	      {
	        if( dest.isPubSub())
	        {
	          PubSubInputHandler inputHandler = (PubSubInputHandler)dest.getInputHandler();
	          inputHandler.reconstitutePubSubSourceStreams(streamSet, startMode);
	        }
	        else
	        {        
	          outputHandler.reconstitutePtoPSourceStreams(streamSet, startMode);
	        }
	      }
	      catch (SIResourceException e)
	      {
	        // FFDC
	        FFDCFilter.processException(
	          e,
	          "com.ibm.ws.sib.processor.impl.store.itemstreams.SourceProtocolItemStream.reconstituteSourceStreams",
	          "1:179:1.29",
	          this);
	        
	        // Don't do flush if we are asked to start in recovery mode 
	        if(   ((startMode & JsConstants.ME_START_FLUSH ) == JsConstants.ME_START_FLUSH )
	           && ((startMode & JsConstants.ME_START_RECOVERY ) == 0 ) )
	        {
	          // Log message to console saying flush for this steamSet has failed
	          // parmeters are:- ME name, streamSet Uuid, destinationName, exception.
	          SibTr.error(
	            tc,
	            "FLUSH_FAILED_MESSAGE_CWSIP0782",
	            new Object[] {dest.getMessageProcessor().getMessagingEngineName(),
	                          streamSet.getStreamID(),
	                          dest.getName(),
	                          e });
	        }
	        
	        // Rethrow exception after logging error
	        if (tc.isEntryEnabled()) SibTr.exit(tc, "reconstituteSourceStreams");
	        throw(e);
	      
	      }
	    }
    }
    finally
    {
      if (cursor != null)
        cursor.finished();
    }
    
    if (tc.isEntryEnabled())  
      SibTr.exit(tc, "reconstituteSourceStreams");      
  }
1331436
@Override
    protected void initFilterBean() throws ServletException {
        if (this.resourcesElementsProvider == null) {
            final ServletContext servletContext = this.getServletContext();
            this.resourcesElementsProvider = ResourcesElementsProviderUtils.getOrCreateResourcesElementsProvider(servletContext);
        }
    }
394824
function startServlet(cb) {
    startingServer = true;
    servletReady = false;
        debugger;
    findPort(function(port) {
        servletPort = global._servletPort = '' + port;

        servlet = global._servlet = cp.spawn('java', ['-cp', '.:../lib/servlet-api-2.5.jar:../lib/jetty-all-7.0.2.v20100331.jar', 'RunnerServlet', servletPort], {
            cwd: config.rootDir + '/bin'
        });
        servlet.stdout.on('data', function(data) {
            console.log('OUT:' + data);
        });
        servlet.stderr.on('data', function(data) {
            console.log("" + data);
            if (~data.toString().indexOf(servletPort)) {
                servletReady = true;
                startingServer = false;
                // queue.checkQueues();
                observer.emit("server.running", port);
                if (cb) cb(port);
            }
        });

        
        servlet.on('exit', function(code, signal) {
            resetFlags();
            if (code === null || signal === null) {
                serverExit = true;
            }
            log('servlet exist with code ' + code + 'signal ' + signal);
            observer.emit('server.exit',code);
        });
        // make sure to close server after node process ends
        process.on('exit', function() {
            stopServer(true);
        });
    });
}
237921
@SuppressWarnings("unchecked")
    @Override
    public void init() throws ServletException {

        ServletConfig config = getServletConfig();

		// Load the context, if present...
		try {
	        
			// Bootstrap the servlet Grammar instance...
        	final Grammar root = XmlGrammar.getMainGrammar();
	        final InputStream inpt = CernunnosServlet.class.getResourceAsStream("servlet.grammar");	// Can't rely on classpath:// protocol handler...
            final Document doc = new SAXReader().read(inpt);
            final Task k = new ScriptRunner(root).compileTask(doc.getRootElement());
    		final RuntimeRequestResponse req = new RuntimeRequestResponse();
    		final ReturnValueImpl rslt = new ReturnValueImpl();
    		req.setAttribute(Attributes.RETURN_VALUE, rslt);
    		k.perform(req, new RuntimeRequestResponse());
    		Grammar g = (Grammar) rslt.getValue();
	        runner = new ScriptRunner(g);

            // Choose a context location & load it if it exists...
            String defaultLoc = "/WEB-INF/" + config.getServletName() + "-portlet.xml";
            URL defaultUrl = getServletConfig().getServletContext().getResource(defaultLoc);
            URL u = Settings.locateContextConfig(
                    getServletConfig().getServletContext().getResource("/").toExternalForm(),
                        config.getInitParameter(CONFIG_LOCATION_PARAM), 
                        defaultUrl);
            if (u != null) {
                // There *is* a resource mapped to this path name...
                spring_context = new FileSystemXmlApplicationContext(u.toExternalForm());
            }
			
			if (log.isDebugEnabled()) {
				log.debug("Location of spring context (null means none):  " + u);
			}

			// Load the Settings...
			Map<String,String> settingsMap = new HashMap<String,String>();	// default...
			if (spring_context != null && spring_context.containsBean("settings")) {
				settingsMap = (Map<String,String>) spring_context.getBean("settings");
			}
			settings = Settings.load(settingsMap);

		} catch (Throwable t) {
			String msg = "Failure in CernunnosServlet.init()";
			throw new ServletException(msg, t);
		}

    }
862076
@Override
    public void contextInitialized(ServletContextEvent event) {
        _registry.put(INSTANCE, new Pair<Service, Persistence>(this, null));

        _context = event.getServletContext();
        _application = _context.getContextPath();
        _logger.config("application: " + _application);
        if (_application.charAt(0) == '/') _application = _application.substring(1);

        try { ManagementFactory.getPlatformMBeanServer().setAttribute(
            new ObjectName("Catalina:host=localhost,name=AccessLogValve,type=Valve"), new Attribute("condition", "intrinsic")
        ); } catch (Exception x) {}
    }
465926
protected void rebuild() {
		mandatoryArcsList.clear();
		ISet nei;
		for (int i = 0; i < n; i++) {
			nei = gV.getMandNeighOf(i);
			for (int j : nei) {
				if (i < j) {
					mandatoryArcsList.add(i * n + j);
				}
			}
		}
	}
364636
protected synchronized void doStart()
        throws Exception
    {
        if (isStarted())
            return;
        
        _contextLog = LogFactory.getLog("org.browsermob.proxy.jetty.jetty.context."+getHttpContext().getHttpContextName());
        
        if (_contextLog==null)
            _contextLog=log;
        
        if (_sessionManager!=null)
            _sessionManager.start();
        
        // Initialize classloader
        _loader=getHttpContext().getClassLoader();

        if (_autoInitializeServlets)
            initializeServlets();
    }
1310220
public synchronized void shutdown()
   {
      if (factory != null && handlerCount == 0)
      {
         factory.destroyForPort(port);
      }
      else
      {
         LOG.warnv("Failed to shutdown Undertow server on port {0,number,####0} because it is still in use", port);
      }
   }
1346661
@Override
	protected void rebuild() {
		mandatoryArcsList.clear();
		for (int i = 0; i < n; i++) {
			g.getNeighOf(i).clear();
			if (succ[i].isInstantiated()) {
				int j = succ[i].getValue();
				mandatoryArcsList.add(i * n + j); // todo check no need to have i < j
			}
		}
		for (int i = 0; i < n; i++) {
			IntVar v = succ[i];
			int ub = v.getUB();
			for (int j = v.getLB(); j <= ub; j = v.nextValue(j)) {
				g.addEdge(i, j);
			}
		}
	}
1233740
@Override
    public void doReset(
            IPortletWindowId portletWindowId,
            HttpServletRequest httpServletRequest,
            HttpServletResponse httpServletResponse) {

        // Don't enforce config mode restriction because this is going to snap the portlet window
        // back into view mode.

        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(httpServletRequest, portletWindowId);
        if (portletWindow != null) {
            portletWindow.setPortletMode(PortletMode.VIEW);
            portletWindow.setRenderParameters(new ParameterMap());
            portletWindow.setExpirationCache(null);

            httpServletRequest = this.setupPortletRequest(httpServletRequest);
            httpServletResponse =
                    new PortletHttpServletResponseWrapper(httpServletResponse, portletWindow);

            httpServletRequest.setAttribute(
                    AdministrativeRequestListenerController.DEFAULT_LISTENER_KEY_ATTRIBUTE,
                    "sessionActionListener");
            httpServletRequest.setAttribute(
                    PortletSessionAdministrativeRequestListener.ACTION,
                    PortletSessionAdministrativeRequestListener.SessionAction.CLEAR);
            httpServletRequest.setAttribute(
                    PortletSessionAdministrativeRequestListener.SCOPE,
                    PortletSession.PORTLET_SCOPE);

            // TODO modify PortletContainer.doAdmin to create a specific "admin" req/res object and
            // context so we don't have to fake it with a render req
            // These are required for a render request to be created and admin requests use a render
            // request under the hood
            final String characterEncoding = httpServletResponse.getCharacterEncoding();
            httpServletRequest.setAttribute(
                    IPortletRenderer.ATTRIBUTE__PORTLET_OUTPUT_HANDLER,
                    new RenderPortletOutputHandler(characterEncoding));
            httpServletRequest.setAttribute(
                    IPortletRenderer.ATTRIBUTE__PORTLET_CACHE_CONTROL, new CacheControlImpl());

            try {
                this.portletContainer.doAdmin(
                        portletWindow.getPlutoPortletWindow(),
                        httpServletRequest,
                        httpServletResponse);
            } catch (PortletException pe) {
                throw new PortletDispatchException(
                        "The portlet window '"
                                + portletWindow
                                + "' threw an exception while executing admin command to clear session.",
                        portletWindow,
                        pe);
            } catch (PortletContainerException pce) {
                throw new PortletDispatchException(
                        "The portlet container threw an exception while executing admin command to clear session on portlet window '"
                                + portletWindow
                                + "'.",
                        portletWindow,
                        pce);
            } catch (IOException ioe) {
                throw new PortletDispatchException(
                        "The portlet window '"
                                + portletWindow
                                + "' threw an exception while executing admin command to clear session.",
                        portletWindow,
                        ioe);
            }
        } else {
            logger.debug(
                    "ignoring doReset as portletWindowRegistry#getPortletWindow returned a null result for portletWindowId {}",
                    portletWindowId);
        }
    }