예제 #1
0
 public static List getApplicationServletMaps(Context context) {
   String[] sms = context.findServletMappings();
   List servletMaps = new ArrayList(sms.length);
   for (String servletMapping : sms) {
     if (servletMapping != null) {
       String sn = context.findServletMapping(servletMapping);
       if (sn != null) {
         ServletMapping sm = new ServletMapping();
         sm.setApplicationName(context.getName().length() > 0 ? context.getName() : "/");
         sm.setUrl(servletMapping);
         sm.setServletName(sn);
         Container container = context.findChild(sn);
         if (container instanceof Wrapper) {
           Wrapper wrapper = (Wrapper) container;
           sm.setServletClass(wrapper.getServletClass());
           sm.setAvailable(!wrapper.isUnavailable());
         }
         servletMaps.add(sm);
       }
     }
   }
   return servletMaps;
 }
예제 #2
0
 private static ServletInfo getServletInfo(Wrapper wrapper, String contextName) {
   ServletInfo si = new ServletInfo();
   si.setApplicationName(contextName.length() > 0 ? contextName : "/");
   si.setServletName(wrapper.getName());
   si.setServletClass(wrapper.getServletClass());
   si.setAvailable(!wrapper.isUnavailable());
   si.setLoadOnStartup(wrapper.getLoadOnStartup());
   si.setRunAs(wrapper.getRunAs());
   si.getMappings().addAll(Arrays.asList(wrapper.findMappings()));
   if (wrapper instanceof StandardWrapper) {
     StandardWrapper sw = (StandardWrapper) wrapper;
     si.setAllocationCount(sw.getCountAllocated());
     si.setErrorCount(sw.getErrorCount());
     si.setLoadTime(sw.getLoadTime());
     si.setMaxInstances(sw.getMaxInstances());
     si.setMaxTime(sw.getMaxTime());
     si.setMinTime(sw.getMinTime() == Long.MAX_VALUE ? 0 : sw.getMinTime());
     si.setProcessingTime(sw.getProcessingTime());
     si.setRequestCount(sw.getRequestCount());
     si.setSingleThreaded(sw.isSingleThreadModel());
   }
   return si;
 }