private Map < String , String > getServletNameClassPairsInWebXML ( Container containerToAdapt ) throws UnableToAdaptException { Map < String , String > nameClassPairs = new HashMap < String , String > ( ) ; WebAppConfig webAppConfig = containerToAdapt . adapt ( WebAppConfig . class ) ; Iterator < IServletConfig > cfgIter = webAppConfig . getServletInfos ( ) ; while ( cfgIter . hasNext ( ) ) { IServletConfig servletCfg = cfgIter . next ( ) ; if ( servletCfg . getClassName ( ) == null ) { continue ; } nameClassPairs . put ( servletCfg . getServletName ( ) , servletCfg . getClassName ( ) ) ; } return nameClassPairs ; }
Get all the Servlet name and className pairs from web . xml