private WebConfiguration getWebConfig(FacesContext context) { if (webConfig == null) { webConfig = WebConfiguration.getInstance(context.getExternalContext()); } return webConfig; }
public CompilationManager(String alias, Compiler compiler) { // this is our alias this.alias = alias; // grab compiler state this.compiler = compiler; this.tagDecorator = compiler.createTagDecorator(); this.tagLibrary = compiler.createTagLibrary(this.getCompilationMessageHolder()); // namespace management this.namespaceManager = new NamespaceManager(); // tag uids this.tagId = 0; // for composition use this.finished = false; // our compilationunit stack this.units = new Stack<CompilationUnit>(); this.units.push(new CompilationUnit()); config = WebConfiguration.getInstance(); }
public ClasspathResourceHelper() { WebConfiguration webconfig = WebConfiguration.getInstance(); cacheTimestamp = webconfig.isOptionEnabled(CacheResourceModificationTimestamp); enableMissingResourceLibraryDetection = webconfig.isOptionEnabled(EnableMissingResourceLibraryDetection); }
public ResponseStateManagerImpl() { WebConfiguration webConfig = WebConfiguration.getInstance(); String stateMode = webConfig.getOptionValue(StateSavingMethod); helper = ((StateManager.STATE_SAVING_METHOD_CLIENT.equalsIgnoreCase(stateMode) ? new ClientSideStateHelper() : new ServerSideStateHelper())); }
public MultiViewHandler() { WebConfiguration config = WebConfiguration.getInstance(); String defaultSuffixConfig = config.getOptionValue(WebConfiguration.WebContextInitParameter.DefaultSuffix); configuredExtensions = Util.split(defaultSuffixConfig, " "); pdlFactory = (PageDeclarationLanguageFactory) FactoryFinder.getFactory(FactoryFinder.PAGE_DECLARATION_LANGUAGE_FACTORY); }
public MultiViewHandler() { WebConfiguration config = WebConfiguration.getInstance(); configuredExtensions = config.getOptionValue(WebConfiguration.WebContextInitParameter.DefaultSuffix, " "); extensionsSet = config.isSet(WebConfiguration.WebContextInitParameter.DefaultSuffix); vdlFactory = (ViewDeclarationLanguageFactory) FactoryFinder.getFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY); }
/** * Tries to find a provider class in a web context parameter. If not present it tries to find it * as a System property. If still not found returns null. * * @param extContext The ExternalContext for this request * @return The provider class name specified in the container configuration, or <code>null</code> * if not found. */ private static String findProviderClass(ExternalContext extContext) { WebConfiguration webConfig = WebConfiguration.getInstance(extContext); String provider = webConfig.getOptionValue(WebContextInitParameter.SerializationProviderClass); if (provider != null) { return provider; } else { return System.getProperty(SERIALIZATION_PROVIDER_PROPERTY); } }
/** Construct a new <code>ServerSideStateHelper</code> instance. */ public ServerSideStateHelper() { numberOfLogicalViews = getIntegerConfigValue(NumberOfLogicalViews); numberOfViews = getIntegerConfigValue(NumberOfViews); WebConfiguration webConfig = WebConfiguration.getInstance(); generateUniqueStateIds = webConfig.isOptionEnabled(GenerateUniqueServerStateIds); if (generateUniqueStateIds) { random = new Random(System.nanoTime() + webConfig.getServletContext().hashCode()); } else { random = null; } namespaceParameters = webConfig.isOptionEnabled(NamespaceParameters); }
/** * Loads the contents of the sunjsf.js file into memory removing any comments/empty lines it * encoutners, and, if enabled, compressing the result. This method should only be called when the * application is being initialized. * * @param extContext the ExternalContext for this application */ public static synchronized void loadSunJsfJs(ExternalContext extContext) { Map<String, Object> appMap = extContext.getApplicationMap(); char[] sunJsfJs; BufferedReader reader = null; try { // Don't use Util.getCurrentLoader(). This JS resource should // be available from the same classloader that loaded RenderKitUtils. // Doing so allows us to be more OSGi friendly. URL url = RenderKitUtils.class.getClassLoader().getResource("com/sun/faces/sunjsf.js"); if (url == null) { LOGGER.severe("jsf.renderkit.util.cannot_load_js"); return; } URLConnection conn = url.openConnection(); conn.setUseCaches(false); InputStream input = conn.getInputStream(); reader = new BufferedReader(new InputStreamReader(input)); StringBuilder builder = new StringBuilder(128); for (String line = reader.readLine(); line != null; line = reader.readLine()) { String temp = line.trim(); if (temp.length() == 0 || temp.startsWith("/*") || temp.startsWith("*") || temp.startsWith("*/") || temp.startsWith("//")) { continue; } builder.append(line).append('\n'); } builder.deleteCharAt(builder.length() - 1); if (WebConfiguration.getInstance(extContext) .isOptionEnabled(BooleanWebContextInitParameter.CompressJavaScript)) { sunJsfJs = compressJS(builder.toString()); } else { sunJsfJs = builder.toString().toCharArray(); } appMap.put(SUN_JSF_JS, sunJsfJs); } catch (IOException ioe) { LOGGER.log(Level.SEVERE, "jsf.renderkit.util.cannot_load_js", ioe); } finally { if (reader != null) { try { reader.close(); } catch (IOException ioe) { // ignore } } } }
private WebConfiguration getWebConfiguration(WebConfiguration webConfig) { if (webConfig != null) { return webConfig; } FacesContext context = FacesContext.getCurrentInstance(); if (null != context) { ExternalContext extContext = context.getExternalContext(); if (null != extContext) { webConfig = WebConfiguration.getInstance(extContext); } } return webConfig; }
/** * This method bootstraps JSF based on the parsed configuration resources. * * @param sc the <code>ServletContext</code> for the application that requires initialization */ public void initialize(ServletContext sc) { if (!hasBeenInitialized(sc)) { initializedContexts.add(sc); try { WebConfiguration webConfig = WebConfiguration.getInstance(sc); boolean validating = webConfig.isOptionEnabled(ValidateFacesConfigFiles); ExecutorService executor = createExecutorService(); Document[] facesDocuments = getConfigDocuments(sc, getFacesConfigResourceProviders(), executor, validating); WebInfFacesConfigInfo facesConfigInfo = new WebInfFacesConfigInfo(facesDocuments[facesDocuments.length - 1]); facesDocuments = sortDocuments(facesDocuments, facesConfigInfo); boolean isFaceletsDisabled = isFaceletsDisabled(webConfig, facesConfigInfo); if (!facesConfigInfo.isMetadataComplete()) { // execute the Task responsible for finding annotation classes Future<Map<Class<? extends Annotation>, Set<Class<?>>>> annotationScan = executor.submit(new AnnotationScanTask(sc)); pushTaskToContext(sc, annotationScan); } // process the ordered documents FACES_CONFIG_PROCESSOR_CHAIN.process(facesDocuments); if (!isFaceletsDisabled) { FACELET_TAGLIB_CONFIG_PROCESSOR_CHAIN.process( getConfigDocuments(sc, getFaceletConfigResourceProviders(), executor, validating)); } executor.shutdown(); publishPostConfigEvent(); } catch (Exception e) { // clear out any configured factories releaseFactories(); if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, "Unsanitized stacktrace from failed start...", e); } Throwable t = unwind(e); throw new ConfigurationException("CONFIGURATION FAILED! " + t.getMessage(), t); } finally { sc.removeAttribute(ANNOTATIONS_SCAN_TASK_KEY); } } }
public ApplicationAssociate(ApplicationImpl appImpl) { app = appImpl; propertyEditorHelper = new PropertyEditorHelper(appImpl); FacesContext ctx = FacesContext.getCurrentInstance(); if (ctx == null) { throw new IllegalStateException( MessageUtils.getExceptionMessageString( MessageUtils.APPLICATION_ASSOCIATE_CTOR_WRONG_CALLSTACK_ID)); } ExternalContext externalContext = ctx.getExternalContext(); if (null != externalContext.getApplicationMap().get(ASSOCIATE_KEY)) { throw new IllegalStateException( MessageUtils.getExceptionMessageString(MessageUtils.APPLICATION_ASSOCIATE_EXISTS_ID)); } externalContext.getApplicationMap().put(ASSOCIATE_KEY, this); //noinspection CollectionWithoutInitialCapacity navigationMap = new ConcurrentHashMap<String, Set<NavigationCase>>(); injectionProvider = InjectionProviderFactory.createInstance(externalContext); WebConfiguration webConfig = WebConfiguration.getInstance(externalContext); beanManager = new BeanManager(injectionProvider, webConfig.isOptionEnabled(EnableLazyBeanValidation)); // install the bean manager as a system event listener for custom // scopes being destoryed. app.subscribeToEvent(PreDestroyCustomScopeEvent.class, ScopeContext.class, beanManager); annotationManager = new AnnotationManager(); groovyHelper = GroovyHelper.getCurrentInstance(); devModeEnabled = (appImpl.getProjectStage() == ProjectStage.Development); // initialize Facelets if (!webConfig.isOptionEnabled(DisableFaceletJSFViewHandler)) { compiler = createCompiler(webConfig); faceletFactory = createFaceletFactory(compiler, webConfig); } if (!devModeEnabled) { resourceCache = new ResourceCache(); } resourceManager = new ResourceManager(resourceCache); namedEventManager = new NamedEventManager(); applicationStateInfo = new ApplicationStateInfo(); }
/** * Renders the Javascript necessary to add and remove request parameters to the current form. * * @param writer the <code>ResponseWriter</code> * @param context the <code>FacesContext</code> for the current request * @throws java.io.IOException if an error occurs writing to the response */ public static void renderFormInitScript(ResponseWriter writer, FacesContext context) throws IOException { WebConfiguration webConfig = WebConfiguration.getInstance(context.getExternalContext()); if (webConfig.isOptionEnabled(BooleanWebContextInitParameter.ExternalizeJavaScript)) { // PENDING // We need to look into how to make this work in a portlet environment. // For the time being, this feature will need to be disabled when running // in a portlet. /* String mapping = Util.getFacesMapping(context); String uri; if ((mapping != null) && (Util.isPrefixMapped(mapping))) { uri = mapping + '/' + RIConstants.SUN_JSF_JS_URI; } else { uri = '/' + RIConstants.SUN_JSF_JS_URI + mapping; } writer.write('\n'); writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("src", context.getExternalContext() .getRequestContextPath() + uri, null); writer.endElement("script"); writer.write("\n"); */ ResourceHandler handler = context.getApplication().getResourceHandler(); Resource resource = handler.createResource("scripts/sunjsf.js", "jsfri"); writer.write('\n'); writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("src", ((resource != null) ? resource.getRequestPath() : ""), null); writer.endElement("script"); } else { writer.write('\n'); writer.startElement("script", null); writer.writeAttribute("type", "text/javascript", null); writer.writeAttribute("language", "Javascript", null); writeSunJS(context, writer); writer.endElement("script"); writer.write("\n"); } }
public void testClientResourceInfoCompression() throws Exception { WebConfiguration config = WebConfiguration.getInstance(); config.overrideContextInitParameter( WebConfiguration.WebContextInitParameter.CompressableMimeTypes, "image/gif,text/css,text/plain"); // create a new ResourceManager so that the mime type configuration is picked up ResourceManager manager = new ResourceManager(null); ClientResourceInfo resource = (ClientResourceInfo) manager.findResource("nvLibrary", "duke-nv.gif", "image/gif", getFacesContext()); assertTrue(resource != null); assertTrue(resource.isCompressable()); assertTrue(compressionPathIsValid(resource)); // ensure compression disabled for a content type that is null resource = (ClientResourceInfo) manager.findResource("nvLibrary", "duke-nv.gif", "text/javascript", getFacesContext()); assertTrue(resource != null); assertTrue(!resource.isCompressable()); assertTrue(resource.getCompressedPath() == null); // if a resource is compressable, but the compressed result is larger // than the original resource, the returned ClientResourceInfo shouldn't // be marked as compressable and getCompressedPath() will be null resource = (ClientResourceInfo) manager.findResource(null, "simple.txt", "text/plain", getFacesContext()); assertTrue(resource != null); assertTrue(!resource.isCompressable()); assertTrue(resource.getCompressedPath() == null); // if a resource is compressable, but the compressed result is larger // than the original resource, the returned ClientResourceInfo should be // marked compressable. However, since css files may have EL expressions // embedded within, the the resource will be marked as supporting such. resource = (ClientResourceInfo) manager.findResource(null, "simple.css", "text/plain", getFacesContext()); assertTrue(resource != null); assertTrue(resource.isCompressable()); assertTrue(resource.supportsEL()); assertTrue(resource.getCompressedPath() == null); }
public ApplicationAssociate(ApplicationImpl appImpl) { app = appImpl; propertyEditorHelper = new PropertyEditorHelper(appImpl); FacesContext ctx = FacesContext.getCurrentInstance(); if (ctx == null) { throw new IllegalStateException( MessageUtils.getExceptionMessageString( MessageUtils.APPLICATION_ASSOCIATE_CTOR_WRONG_CALLSTACK_ID)); } ExternalContext externalContext = ctx.getExternalContext(); if (null != externalContext.getApplicationMap().get(ASSOCIATE_KEY)) { throw new IllegalStateException( MessageUtils.getExceptionMessageString(MessageUtils.APPLICATION_ASSOCIATE_EXISTS_ID)); } externalContext.getApplicationMap().put(ASSOCIATE_KEY, this); //noinspection CollectionWithoutInitialCapacity caseListMap = new HashMap<String, List<ConfigNavigationCase>>(); wildcardMatchList = new TreeSet<String>(new SortIt()); injectionProvider = InjectionProviderFactory.createInstance(externalContext); WebConfiguration webConfig = WebConfiguration.getInstance(externalContext); beanManager = new BeanManager( injectionProvider, webConfig.isOptionEnabled(BooleanWebContextInitParameter.EnableLazyBeanValidation)); annotationManager = new AnnotationManager(); groovyHelper = GroovyHelper.getCurrentInstance(); // initialize Facelets if (!webConfig.isOptionEnabled(BooleanWebContextInitParameter.DisableFaceletJSFViewHandler)) { compiler = createCompiler(webConfig); faceletFactory = createFaceletFactory(compiler, webConfig); devModeEnabled = (appImpl.getProjectStage() == ProjectStage.Development); } if (devModeEnabled) { resourceCache = new ResourceCache(); } resourceManager = new ResourceManager(resourceCache); }
public ExternalContextImpl(ServletContext sc, ServletRequest request, ServletResponse response) { // Validate the incoming parameters try { Util.notNull("sc", sc); Util.notNull("request", request); Util.notNull("response", response); } catch (Exception e) { throw new FacesException( MessageUtils.getExceptionMessageString( MessageUtils.FACES_CONTEXT_CONSTRUCTION_ERROR_MESSAGE_ID)); } // Save references to our context, request, and response this.servletContext = sc; this.request = request; this.response = response; WebConfiguration config = WebConfiguration.getInstance(sc); if (config.isOptionEnabled(BooleanWebContextInitParameter.SendPoweredByHeader)) { ((HttpServletResponse) response).addHeader("X-Powered-By", "JSF/2.0"); } }
/** Initialize the core Facelets runtime. */ protected void initialize() { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Initializing FaceletViewHandlingStrategy"); } this.initializeMappings(); WebConfiguration config = WebConfiguration.getInstance(); partialStateSaving = config.isOptionEnabled(PartialStateSaving); if (partialStateSaving) { String[] viewIds = config.getOptionValue(FullStateSavingViewIds, ","); fullStateViewIds = new HashSet<String>(viewIds.length, 1.0f); fullStateViewIds.addAll(Arrays.asList(viewIds)); this.stateManagementStrategy = new StateManagementStrategyImpl(this); } groovyAvailable = GroovyHelper.isGroovyAvailable(FacesContext.getCurrentInstance()); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Initialization Successful"); } }
@Override public void encodeChildren(FacesContext context, UIComponent component) throws IOException { boolean renderChildren = WebConfiguration.getInstance() .isOptionEnabled(WebConfiguration.BooleanWebContextInitParameter.AllowTextChildren); if (!renderChildren) { return; } rendererParamsNotNull(context, component); if (!shouldEncodeChildren(component)) { return; } if (component.getChildCount() > 0) { for (UIComponent kid : component.getChildren()) { encodeRecursive(context, kid); } } }
public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); Timer timer = Timer.getInstance(); if (timer != null) { timer.startTiming(); } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, MessageFormat.format( "ConfigureListener.contextInitialized({0})", getServletContextIdentifier(context))); } webConfig = WebConfiguration.getInstance(context); ConfigManager configManager = ConfigManager.getInstance(); if (configManager.hasBeenInitialized(context)) { return; } // Check to see if the FacesServlet is present in the // web.xml. If it is, perform faces configuration as normal, // otherwise, simply return. Object mappingsAdded = context.getAttribute(RIConstants.FACES_INITIALIZER_MAPPINGS_ADDED); if (mappingsAdded != null) { context.removeAttribute(RIConstants.FACES_INITIALIZER_MAPPINGS_ADDED); } WebXmlProcessor webXmlProcessor = new WebXmlProcessor(context); if (mappingsAdded == null) { if (!webXmlProcessor.isFacesServletPresent()) { if (!webConfig.isOptionEnabled(ForceLoadFacesConfigFiles)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "No FacesServlet found in deployment descriptor - bypassing configuration"); } WebConfiguration.clear(context); return; } } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log( Level.FINE, "FacesServlet found in deployment descriptor - processing configuration."); } } } // bootstrap of faces required webAppListener = new WebappLifecycleListener(context); webAppListener.contextInitialized(sce); InitFacesContext initContext = new InitFacesContext(context); ReflectionUtils.initCache(Thread.currentThread().getContextClassLoader()); Throwable caughtThrowable = null; try { if (LOGGER.isLoggable(Level.INFO)) { LOGGER.log(Level.INFO, "jsf.config.listener.version", getServletContextIdentifier(context)); } // see if we need to disable our TLValidator Util.setHtmlTLVActive(webConfig.isOptionEnabled(EnableHtmlTagLibraryValidator)); if (webConfig.isOptionEnabled(VerifyFacesConfigObjects)) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("jsf.config.verifyobjects.development_only"); } // if we're verifying, force bean validation to occur at startup as well webConfig.overrideContextInitParameter(EnableLazyBeanValidation, false); Verifier.setCurrentInstance(new Verifier()); } initScripting(); configManager.initialize(context); if (shouldInitConfigMonitoring()) { initConfigMonitoring(context); } // Step 7, verify that all the configured factories are available // and optionall that configured objects can be created. Verifier v = Verifier.getCurrentInstance(); if (v != null && !v.isApplicationValid()) { if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.severe("jsf.config.verifyobjects.failures_detected"); StringBuilder sb = new StringBuilder(128); for (String m : v.getMessages()) { sb.append(m).append('\n'); } LOGGER.severe(sb.toString()); } } registerELResolverAndListenerWithJsp(context, false); ELContext elctx = new ELContextImpl(initContext.getApplication().getELResolver()); elctx.putContext(FacesContext.class, initContext); initContext.setELContext(elctx); ApplicationAssociate associate = ApplicationAssociate.getInstance(context); if (associate != null) { associate.setContextName(getServletContextIdentifier(context)); BeanManager manager = associate.getBeanManager(); List<String> eagerBeans = manager.getEagerBeanNames(); if (!eagerBeans.isEmpty()) { for (String name : eagerBeans) { manager.create(name, initContext); } } boolean isErrorPagePresent = webXmlProcessor.isErrorPagePresent(); associate.setErrorPagePresent(isErrorPagePresent); context.setAttribute(RIConstants.ERROR_PAGE_PRESENT_KEY_NAME, isErrorPagePresent); } Application app = initContext.getApplication(); app.subscribeToEvent(PostConstructViewMapEvent.class, UIViewRoot.class, webAppListener); app.subscribeToEvent(PreDestroyViewMapEvent.class, UIViewRoot.class, webAppListener); webConfig.doPostBringupActions(); } catch (Throwable t) { if (LOGGER.isLoggable(Level.SEVERE)) { LOGGER.log(Level.SEVERE, "Critical error during deployment: ", t); } caughtThrowable = t; } finally { Verifier.setCurrentInstance(null); initContext.release(); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "jsf.config.listener.version.complete"); } if (timer != null) { timer.stopTiming(); timer.logResult("Initialization of context " + getServletContextIdentifier(context)); } if (null != caughtThrowable) { throw new RuntimeException(caughtThrowable); } } }
private boolean isDevModeEnabled() { WebConfiguration webconfig = WebConfiguration.getInstance(); return (webconfig != null && "Development" .equals(webconfig.getOptionValue(WebContextInitParameter.JavaxFacesProjectStage))); }
protected String resolveResourceUrl( FacesContext context, UIComponent component, String library, String name) { Map<Object, Object> contextMap = context.getAttributes(); String key = name + library; if (null == name) { return null; } // Ensure this import is not rendered more than once per request if (contextMap.containsKey(key)) { return null; } contextMap.put(key, Boolean.TRUE); // Special case of scripts that have query strings // These scripts actually use their query strings internally, not externally // so we don't need the resource to know about them int queryPos = name.indexOf("?"); String query = null; if (queryPos > -1 && name.length() > queryPos) { query = name.substring(queryPos + 1); name = name.substring(0, queryPos); } Resource resource = context.getApplication().getResourceHandler().createResource(name, library); String resourceSrc = "RES_NOT_FOUND"; WebConfiguration webConfig = WebConfiguration.getInstance(); if (library == null && name != null && name.startsWith( webConfig.getOptionValue( WebConfiguration.WebContextInitParameter.WebAppContractsDirectory))) { if (context.isProjectStage(ProjectStage.Development)) { String msg = "Illegal path, direct contract references are not allowed: " + name; context.addMessage( component.getClientId(context), new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg)); } resource = null; } if (resource == null) { if (context.isProjectStage(ProjectStage.Development)) { String msg = "Unable to find resource " + (library == null ? "" : library + ", ") + name; context.addMessage( component.getClientId(context), new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg)); } } else { resourceSrc = resource.getRequestPath(); if (query != null) { resourceSrc = resourceSrc + ((resourceSrc.indexOf("?") > -1) ? "&" : "?") + query; } resourceSrc = context.getExternalContext().encodeResourceURL(resourceSrc); } return resourceSrc; }
public AjaxBehaviorRenderer() { WebConfiguration webConfig = WebConfiguration.getInstance(); namespaceParameters = webConfig.isOptionEnabled(BooleanWebContextInitParameter.NamespaceParameters); }
private static boolean useThreads(ServletContext ctx) { WebConfiguration config = WebConfiguration.getInstance(ctx); return config.isOptionEnabled(EnableThreading); }
/** * This method bootstraps JSF based on the parsed configuration resources. * * @param sc the <code>ServletContext</code> for the application that requires initialization */ public void initialize(ServletContext sc) { if (!hasBeenInitialized(sc)) { initializedContexts.add(sc); ExecutorService executor = null; try { WebConfiguration webConfig = WebConfiguration.getInstance(sc); boolean validating = webConfig.isOptionEnabled(ValidateFacesConfigFiles); if (useThreads(sc)) { executor = createExecutorService(); } DocumentInfo[] facesDocuments = getConfigDocuments(sc, getFacesConfigResourceProviders(), executor, validating); FacesConfigInfo webInfFacesConfigInfo = new FacesConfigInfo(facesDocuments[facesDocuments.length - 1]); facesDocuments = sortDocuments(facesDocuments, webInfFacesConfigInfo); InitFacesContext context = (InitFacesContext) FacesContext.getCurrentInstance(); InjectionProvider containerConnector = InjectionProviderFactory.createInstance(context.getExternalContext()); context.getAttributes().put(INJECTION_PROVIDER_KEY, containerConnector); boolean isFaceletsDisabled = isFaceletsDisabled(webConfig, webInfFacesConfigInfo); if (!webInfFacesConfigInfo.isWebInfFacesConfig() || !webInfFacesConfigInfo.isMetadataComplete()) { // execute the Task responsible for finding annotation classes ProvideMetadataToAnnotationScanTask taskMetadata = new ProvideMetadataToAnnotationScanTask(facesDocuments, containerConnector); Future<Map<Class<? extends Annotation>, Set<Class<?>>>> annotationScan; if (executor != null) { annotationScan = executor.submit(new AnnotationScanTask(sc, context, taskMetadata)); pushTaskToContext(sc, annotationScan); } else { annotationScan = new FutureTask<Map<Class<? extends Annotation>, Set<Class<?>>>>( new AnnotationScanTask(sc, context, taskMetadata)); ((FutureTask) annotationScan).run(); } pushTaskToContext(sc, annotationScan); } // see if the app is running in a HA enabled env if (containerConnector instanceof HighAvailabilityEnabler) { ((HighAvailabilityEnabler) containerConnector).enableHighAvailability(sc); } // process the ordered documents FACES_CONFIG_PROCESSOR_CHAIN.process(sc, facesDocuments); if (!isFaceletsDisabled) { FACELET_TAGLIB_CONFIG_PROCESSOR_CHAIN.process( sc, getConfigDocuments(sc, getFaceletConfigResourceProviders(), executor, validating)); } publishPostConfigEvent(); } catch (Exception e) { // clear out any configured factories releaseFactories(); Throwable t = e; if (!(e instanceof ConfigurationException)) { t = new ConfigurationException("CONFIGURATION FAILED! " + t.getMessage(), t); } throw (ConfigurationException) t; } finally { if (executor != null) { executor.shutdown(); } sc.removeAttribute(ANNOTATIONS_SCAN_TASK_KEY); } } }