public static Class < ? extends Servlet > createServlet ( String className ) { try { return Class . forName ( className ) . asSubclass ( Servlet . class ) ; } catch ( ClassNotFoundException e ) { log . warning ( "The specified class : " + className + " cannot be instantiated " + e . getMessage ( ) ) ; } return null ; }
Reflexion to create the servlet based on the class name . Returns null if the class cannot be instantiated .