@ SuppressWarnings ( "unchecked" ) private void loadServlets ( Map < String , ServletConfiguration > servlets , Environment environment ) throws ClassNotFoundException { if ( servlets != null ) { for ( Map . Entry < String , ServletConfiguration > servletEntry : servlets . entrySet ( ) ) { ServletConfiguration servlet = servletEntry . getValue ( ) ; // Create servlet holder ServletHolder servletHolder = new ServletHolder ( ( Class < ? extends Servlet > ) Class . forName ( servlet . getClazz ( ) ) ) ; // Set name of servlet servletHolder . setName ( servletEntry . getKey ( ) ) ; // Set params if ( servlet . getParam ( ) != null ) { for ( Map . Entry < String , String > entry : servlet . getParam ( ) . entrySet ( ) ) { servletHolder . setInitParameter ( entry . getKey ( ) , entry . getValue ( ) ) ; } } // Add servlet environment . getApplicationContext ( ) . addServlet ( servletHolder , servlet . getUrl ( ) ) ; } } }
Load all servlets .