List of usage examples for javax.servlet ServletContainerInitializer getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.wso2.carbon.tomcat.internal.SCIRegistrarContextConfig.java
@Override protected void processServletContainerInitializers(ServletContext servletContext) { //Scan JARs for ServletContainerInitializer implementations. // Code below is from {@link org.apache.catalina.startup.ContextConfig} List<ServletContainerInitializer> detectedScis; try {// w w w . j a va2 s .co m WebappServiceLoader<ServletContainerInitializer> loader = new WebappServiceLoader<ServletContainerInitializer>( servletContext, context.getContainerSciFilter()); detectedScis = loader.load(ServletContainerInitializer.class); } catch (IOException e) { log.error(sm.getString("contextConfig.servletContainerInitializerFail", context.getName()), e);//prints the full stack trace ok = false; return; } //code belongs to org.wso2.carbon.tomcat.internal.SCIRegistrarContextConfig List<ServletContainerInitializer> mutableDetectedScis = getCustomSciList(detectedScis); // Code below is from {@link org.apache.catalina.startup.ContextConfig} //made changes in logging. for (ServletContainerInitializer sci : mutableDetectedScis) { initializerClassMap.put(sci, new HashSet<Class<?>>()); HandlesTypes ht; try { ht = sci.getClass().getAnnotation(HandlesTypes.class); } catch (Exception e) {//class defined in the @HandlesTypes annotation can be missing.Can throw // NullPointerException. if (log.isDebugEnabled()) { log.debug(sm.getString("contextConfig.sci.debug", sci.getClass().getName()), e);//changed log.info to log.debug.The debug level prints the full stack trace. } else { log.info(sm.getString("contextConfig.sci.info", sci.getClass().getName())); } continue; } if (ht == null) { continue; } Class<?>[] types = ht.value(); if (types == null) { continue; } for (Class<?> type : types) { if (type.isAnnotation()) { handlesTypesAnnotations = true; } else { handlesTypesNonAnnotations = true; } Set<ServletContainerInitializer> scis = typeInitializerMap.get(type); if (scis == null) { scis = new HashSet<ServletContainerInitializer>(); typeInitializerMap.put(type, scis); } scis.add(sci); } } }