src/main/java/js/servlet/TinyContainer.java
@Override
	public void contextInitialized(ServletContextEvent contextEvent) {
		final ServletContext servletContext = contextEvent.getServletContext();

		/** Logger diagnostic context stores contextual information regarding current request. */
		LogContext logContext = LogFactory.getLogContext();
		logContext.put(LOG_CONTEXT_APP, servletContext.getContextPath().isEmpty() ? TinyContainer.ROOT_CONTEXT : servletContext.getContextPath().substring(1));

		final long start = System.currentTimeMillis();
		log.debug("Starting application |%s| container...", servletContext.getContextPath());

		Enumeration<String> parameterNames = servletContext.getInitParameterNames();
		while (parameterNames.hasMoreElements()) {
			final String name = parameterNames.nextElement();
			final String value = servletContext.getInitParameter(name);
			contextParameters.setProperty(name, value);
			log.debug("Load context parameter |%s| value |%s|.", name, value);
		}

		try {
			ConfigBuilder builder = new TinyConfigBuilder(servletContext, contextParameters);
			config(builder.build());

			Factory.bind(this);
			start();

			// set tiny container reference on servlet context attribute ONLY if no exception
			servletContext.setAttribute(TinyContainer.ATTR_INSTANCE, this);
			log.info("Application |%s| container started in %d msec.", appName, System.currentTimeMillis() - start);
		} catch (ConfigException e) {
			log.error(e);
			log.fatal("Bad container |%s| configuration.", appName);
		} catch (Throwable t) {
			log.dump(String.format("Fatal error on container |%s| start:", appName), t);
		}
	}
@Override
	public void contextInitialized(ServletContextEvent contextEvent) {
		final ServletContext servletContext = contextEvent.getServletContext();

		/** Logger diagnostic context stores contextual information regarding current request. */
		LogContext logContext = LogFactory.getLogContext();
		logContext.put(LOG_CONTEXT_APP, servletContext.getContextPath().isEmpty() ? TinyContainer.ROOT_CONTEXT : servletContext.getContextPath().substring(1));

		final long start = System.currentTimeMillis();
		log.debug("Starting application |%s| container...", servletContext.getContextPath());

		Enumeration<String> parameterNames = servletContext.getInitParameterNames();
		while (parameterNames.hasMoreElements()) {
			final String name = parameterNames.nextElement();
			final String value = servletContext.getInitParameter(name);
			contextParameters.setProperty(name, value);
			log.debug("Load context parameter |%s| value |%s|.", name, value);
		}

		try {
			ConfigBuilder builder = new TinyConfigBuilder(servletContext, contextParameters);
			config(builder.build());

			Factory.bind(this);
			start();

			// set tiny container reference on servlet context attribute ONLY if no exception
			servletContext.setAttribute(TinyContainer.ATTR_INSTANCE, this);
			log.info("Application |%s| container started in %d msec.", appName, System.currentTimeMillis() - start);
		} catch (ConfigException e) {
			log.error(e);
			log.fatal("Bad container |%s| configuration.", appName);
		} catch (Throwable t) {
			log.dump(String.format("Fatal error on container |%s| start:", appName), t);
		}
	}
@ Override public void contextInitialized ( ServletContextEvent contextEvent ) { final ServletContext servletContext = contextEvent . getServletContext ( ) ; /** Logger diagnostic context stores contextual information regarding current request. */ LogContext logContext = LogFactory . getLogContext ( ) ; logContext . put ( LOG_CONTEXT_APP , servletContext . getContextPath ( ) . isEmpty ( ) ? TinyContainer . ROOT_CONTEXT : servletContext . getContextPath ( ) . substring ( 1 ) ) ; final long start = System . currentTimeMillis ( ) ; log . debug ( "Starting application |%s| container..." , servletContext . getContextPath ( ) ) ; Enumeration < String > parameterNames = servletContext . getInitParameterNames ( ) ; while ( parameterNames . hasMoreElements ( ) ) { final String name = parameterNames . nextElement ( ) ; final String value = servletContext . getInitParameter ( name ) ; contextParameters . setProperty ( name , value ) ; log . debug ( "Load context parameter |%s| value |%s|." , name , value ) ; } try { ConfigBuilder builder = new TinyConfigBuilder ( servletContext , contextParameters ) ; config ( builder . build ( ) ) ; Factory . bind ( this ) ; start ( ) ; // set tiny container reference on servlet context attribute ONLY if no exception
 servletContext . setAttribute ( TinyContainer . ATTR_INSTANCE , this ) ; log . info ( "Application |%s| container started in %d msec." , appName , System . currentTimeMillis ( ) - start ) ; } catch ( ConfigException e ) { log . error ( e ) ; log . fatal ( "Bad container |%s| configuration." , appName ) ; } catch ( Throwable t ) { log . dump ( String . format ( "Fatal error on container |%s| start:" , appName ) , t ) ; } }
Implements tiny container boostrap logic. See class description for overall performed steps. Also loads context
parameters from external descriptors using {@link ServletContext#getInitParameter(String)}.
<p>
Context initialized listener is not allowed to throw exceptions and it seems there is no standard way to ask servlet
container to abort launching the web application. Tiny container solution is to leave servlet context attribute
{@link #ATTR_INSTANCE} null. On {@link AppServlet#init(javax.servlet.ServletConfig)} mentioned attribute is tested for
null and, if so, permanently mark servlet unavailable.
<p>
<b>Implementation note:</b> bootstrap process logic is based on assumption that this <code>contextInitialized</code>
handler is called before servlets initialization. Here is the relevant excerpt from API-DOC: <em>All
ServletContextListeners are notified of context initialization before any filter or servlet in the web application is
initialized.</em>

@param contextEvent context event provided by servlet container.
Implements tiny container boostrap logic . See class description for overall performed steps . Also loads context parameters from external descriptors using { @link ServletContext#getInitParameter ( String ) } . <p > Context initialized listener is not allowed to throw exceptions and it seems there is no standard way to ask servlet container to abort launching the web application . Tiny container solution is to leave servlet context attribute { @link #ATTR_INSTANCE } null . On { @link AppServlet#init ( javax . servlet . ServletConfig ) } mentioned attribute is tested for null and if so permanently mark servlet unavailable . <p > <b > Implementation note : < / b > bootstrap process logic is based on assumption that this <code > contextInitialized< / code > handler is called before servlets initialization . Here is the relevant excerpt from API - DOC : <em > All ServletContextListeners are notified of context initialization before any filter or servlet in the web application is initialized . < / em >