Configure the web application(s).
@param handlers
@throws Exception
329219
protected void addModulesToJetty(ContextHandlerCollection handlers) throws Exception {
    	/* *************
         * Gateway API
         * ************* */
        ServletContextHandler gatewayApiServer = new ServletContextHandler(ServletContextHandler.SESSIONS);
        addSecurityHandler(gatewayApiServer);
        gatewayApiServer.setContextPath("/api");
        gatewayApiServer.addEventListener(new ResteasyBootstrap());
        gatewayApiServer.addEventListener(new WarGatewayBootstrapper());
        gatewayApiServer.addFilter(HttpRequestThreadLocalFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        gatewayApiServer.addFilter(LocaleFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        gatewayApiServer.addFilter(ApimanCorsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        gatewayApiServer.addFilter(DisableCachingFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        addApiAuthFilter(gatewayApiServer);
        gatewayApiServer.addFilter(RootResourceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        ServletHolder resteasyServlet = new ServletHolder(new HttpServletDispatcher());
        resteasyServlet.setInitParameter("javax.ws.rs.Application", GatewayMicroServiceApplication.class.getName());
        gatewayApiServer.addServlet(resteasyServlet, "/*");
        gatewayApiServer.setInitParameter("resteasy.servlet.mapping.prefix", "");

        handlers.addHandler(gatewayApiServer);


        /* *************
         * Gateway
         * ************* */
        ServletContextHandler gatewayServer = new ServletContextHandler(ServletContextHandler.SESSIONS);
        addSecurityHandler(gatewayServer);
        gatewayServer.setContextPath("/gateway");
        ServletHolder servlet = new ServletHolder(new WarGatewayServlet());
        gatewayServer.addServlet(servlet, "/*");

        handlers.addHandler(gatewayServer);
    }
761182
@Override
  public void registerErrorHandler(final EventHandler<Exception> handler) {
    this.clientEventListener.registerErrorHandler(handler);
    this.serverEventListener.registerErrorHandler(handler);
  }
446865
@SafeVarargs
	public final RestBuilder errorHandler(Class<? extends ExceptionHandler>... handlers) {

		Assert.notNullOrEmpty(handlers, "Missing exception handler(s)!");

		exceptionHandlers.addAll(Arrays.asList(handlers));
		return this;
	}
1015202
protected void configureDefaults() throws Exception
    {
        //next, configure default settings
        for (int i=0;i<_configurations.length;i++)
        {
            _configurations[i].setWebApplicationContext(this);
            _configurations[i].configureDefaults();
        }
    }
741429
@Override
    public void setErrorHandler(ErrorHandler handler) {
        if (errorHandlerLocked) {
            return;
        }
        if (handler == null) {
            handler = base;
        }
        this.errorHandler = handler;
    }
1199082
public ClientBuilder<T> handlers(Handler... handlers) {
        this.handlers = ImmutableList.<Handler>builder().add(handlers).build();
        return this;
    }
286974
private void configureHandlerMappings() {
        Map<String, HandlerMapping> handlerMappings = this.factory.getBeansOfType(HandlerMapping.class);
        if (handlerMappings.isEmpty()) {
            defineBean(BeanNameUrlHandlerMapping.class);
            defineBean(RequestMappingHandlerMapping.class);
        }
    }
848272
protected void configureHandlerInterceptor(ApplicationContext context) {
        if (context.containsBean(HANDLER_INTERCEPTOR_BEAN_NAME)) {
            DelegatingHandlerInterceptor handlerInterceptor = context.getBean(HANDLER_INTERCEPTOR_BEAN_NAME, DelegatingHandlerInterceptor.class);
            handlerInterceptor.setInterceptors(adaptInterceptors(httpServer.getInterceptors(), context));
        }
    }
417175
@Setup(Level.Trial)
  public void setup() throws Exception {
    registry = new MutableHandlerRegistry();
    fullMethodNames = new ArrayList<>(serviceCount * methodCountPerService);
    for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) {
      String serviceName = randomString();
      ServerServiceDefinition.Builder serviceBuilder = ServerServiceDefinition.builder(serviceName);
      for (int methodIndex = 0; methodIndex < methodCountPerService; ++methodIndex) {
        String methodName = randomString();

        MethodDescriptor<Void, Void> methodDescriptor = MethodDescriptor.<Void, Void>newBuilder()
            .setType(MethodDescriptor.MethodType.UNKNOWN)
            .setFullMethodName(MethodDescriptor.generateFullMethodName(serviceName, methodName))
            .setRequestMarshaller(TestMethodDescriptors.voidMarshaller())
            .setResponseMarshaller(TestMethodDescriptors.voidMarshaller())
            .build();
        serviceBuilder.addMethod(methodDescriptor,
            new ServerCallHandler<Void, Void>() {
              @Override
              public Listener<Void> startCall(ServerCall<Void, Void> call,
                  Metadata headers) {
                return null;
              }
            });
        fullMethodNames.add(methodDescriptor.getFullMethodName());
      }
      registry.addService(serviceBuilder.build());
    }
  }
1133992
public static function initialize()
    {
        if (static::$isConfigurationLoaded === true) {
            return;
        }
        
        foreach (static::$handlers as $handler) {
            EventManager::getInstance()->addEventHandler($handler[0], $handler[1], $handler[2], $handler[3]);
        }

        static::$isConfigurationLoaded = true;
    }
635774
public static SentryUncaughtExceptionHandler setup() {
        logger.debug("Configuring uncaught exception handler.");

        Thread.UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
        if (currentHandler != null) {
            logger.debug("default UncaughtExceptionHandler class='" + currentHandler.getClass().getName() + "'");
        }

        SentryUncaughtExceptionHandler handler = new SentryUncaughtExceptionHandler(currentHandler);
        Thread.setDefaultUncaughtExceptionHandler(handler);
        return handler;
    }
134631
public void configureDefaults() throws Exception
    {
        //cannot configure if the context is already started
        if (_context.isStarted())
        {
            if (log.isDebugEnabled()){log.debug("Cannot configure webapp after it is started");};
            return;
        }
        
        getWebApplicationContext().setWelcomeFiles(null);
        
        String defaultsDescriptor=getWebApplicationContext().getDefaultsDescriptor();
        if(defaultsDescriptor!=null&&defaultsDescriptor.length()>0)
        {
            Resource dftResource=Resource.newSystemResource(defaultsDescriptor);
            if(dftResource==null)
                dftResource=Resource.newResource(defaultsDescriptor);
            XmlParser.Node defaultConfig=xmlParser.parse(dftResource.getURL());
            initialize(defaultConfig);
        }
    }
5779
@Override
    public T addHandlers(ArchiveEventHandler... handlers) {
        for (ArchiveEventHandler handler : handlers) {
            this.getArchive().addHandlers(handler);
        }
        return covarientReturn();
    }
1307008
public void start()
        throws Exception
    {
        _unavailable=0;
        super.start();
        
        if (!javax.servlet.Servlet.class
            .isAssignableFrom(_class))
        {
            Exception ex = new IllegalStateException("Servlet "+_class+
                                            " is not a javax.servlet.Servlet");
            super.stop();
            throw ex;
        }        

        _config=new Config();
        if (_runAs!=null)
            _realm=_httpHandler.getHttpContext().getRealm();

        if (javax.servlet.SingleThreadModel.class
            .isAssignableFrom(_class))
            _servlets=new Stack();

        if (_initOnStartup)
        {
            _servlet=(Servlet)newInstance();
            try
            {
                initServlet(_servlet,_config);
            }
            catch(Throwable e)
            {
                _servlet=null;
                _config=null;
                if (e instanceof Exception)
                    throw (Exception) e;
                else if (e instanceof Error)
                    throw (Error)e;
                else
                    throw new ServletException(e);
            }            
        }  
    }
524046
private static void initPrefixHandlers()
    {
        PrefixHandlerConfig[] prefixHandlers = ConfigUtil.getConfig().getPrefixHandlers();
        if ( prefixHandlers == null )
        {
            return;
        }
        for ( int i = 0; i < prefixHandlers.length; i++ )
        {
            try
            {
                Class prefixClass = Class.forName( prefixHandlers[i].getHandlerClass() );
                String name = prefixHandlers[i].getName();
                if ( name == null || name.equals( "" ) )
                {
                    _log.warn( "The name for the prefix handler '" + prefixHandlers[i].getHandlerClass()
                            + "' must not be null" );
                    continue;
                }
                Object o = prefixClass.newInstance();
                if ( !( o instanceof RequestParameterHandler ) )
                {
                    _log.warn( "The class '" + prefixHandlers[i].getHandlerClass()
                            + "' must be an instance of RequestParameterHandler" );
                    continue;
                }
                ProcessPopulate.registerPrefixHandler( name, ( RequestParameterHandler ) o );
            }
            catch ( ClassNotFoundException e )
            {
                _log.warn( "Class '" + prefixHandlers[i].getHandlerClass() + "' not found", e );
            }
            catch ( IllegalAccessException e )
            {
                _log.warn( "Illegal access on Class '" + prefixHandlers[i].getHandlerClass() + "'", e );

            }
            catch ( InstantiationException e )
            {
                _log.warn( "InstantiationException on Class '" + prefixHandlers[i].getHandlerClass() + "'",
                        e.getCause() );
            }
        }
    }
1146670
public void initImpl()
    throws ConfigException
  {
    if (_handler != null) {
    }
    else if (_pathHandler != null) {
    }
    else {
      setPath(Paths.get("."));
    }

    /*
    if (_formatter instanceof ELFormatter) {
      ((ELFormatter)_formatter).init();
    }
    */

    if (_formatter != null) {
    }
    else if (_handler != null && _handler.getFormatter() != null) {
    }
    else {
      _formatter = new PatternFormatter(PatternFormatter.DEFAULT_PATTERN);
    }
    
    if (_pathHandler != null) {
      _pathHandler.init();

      _handler = _pathHandler;
    }
    
    if (_handler == null) {
      throw new ConfigException(L.l("<log-handler> requires a configured log handler"));
    }
    
    // env/02s9
    if (_level != null) {
      _handler.setLevel(_level);
    }

    /* JDK defaults to Level.ALL
    if (_level != null)
      _handler.setLevel(_level);
    else
      _handler.setLevel(Level.INFO);
    */

    if (_formatter != null) {
      _handler.setFormatter(_formatter);
    }

    if (_filter != null) {
      _handler.setFilter(_filter);
    }
    
    if (_names.size() == 0) {
      _names.add("");
    }

    for (String name : _names) {
      Logger logger = Logger.getLogger(name);

      if (! (logger instanceof EnvironmentLogger)) {
        if (_handler instanceof AutoCloseable) {
          EnvLoader.addCloseListener((AutoCloseable) _handler);
        }
      }

      logger.addHandler(_handler);
    }
  }
867975
public void setApplications(java.util.Collection<Application> applications) {
        if (applications == null) {
            this.applications = null;
            return;
        }

        this.applications = new java.util.ArrayList<Application>(applications);
    }