code: private boolean isDevelopmentModeActive(ServletContext servletContext)
     {
  
        // create the ServiceLoader for the SPI
        ServiceLoader<DevelopmentModeDetector> serviceLoader = ServiceLoader.loadTypesafe(DevelopmentModeDetector.class);
  
        // we need a list to be able to sort it
        List<DevelopmentModeDetector> detectors = new ArrayList<DevelopmentModeDetector>();
        for (DevelopmentModeDetector detector : serviceLoader) {
           detectors.add(detector);
        }
  
        // sort them by priority
        Collections.sort(detectors, new Comparator<DevelopmentModeDetector>() {
           public int compare(DevelopmentModeDetector left, DevelopmentModeDetector right)
           {
              return left.getPriority() - right.getPriority();
           }
        });
  
        // process the detectors until one returns a result != null
        for (DevelopmentModeDetector detector : detectors) {
  
           Boolean result = detector.isDevelopmentMode(servletContext);
  
           if (log.isDebugEnabled()) {
              log.debug("Detector " + detector.getClass().getSimpleName() + " returned: " + result);
           }
  
           if (result != null) {
              return result.booleanValue();
           }
  
        }
  
        // default value
        return false;
  
     }
docs: Detects the PrettyFaces development mode using the {@link DevelopmentModeDetector} SPI.