@Override public ServletContainerInitializer getServletContainerInitializer() { if (this.servletContainerInitializer == null) { this.servletContainerInitializer = new FacesInitializer(); } return this.servletContainerInitializer; }
@Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { Set<Class<?>> annotatedClasses = new HashSet<Class<?>>(); if (classes != null) { annotatedClasses.addAll(classes); } servletContext.setAttribute(ANNOTATED_CLASSES, annotatedClasses); boolean appHasSomeJsfContent = appMayHaveSomeJsfContent(classes, servletContext); boolean appHasFacesServlet = getExistingFacesServletRegistration(servletContext) != null; if (appHasSomeJsfContent || appHasFacesServlet) { InitFacesContext initFacesContext = new InitFacesContext(servletContext); try { if (appHasSomeJsfContent) { // Only look at mapping concerns if there is JSF content handleMappingConcerns(servletContext); } // Other concerns also handled if there is an existing Faces Servlet mapping handleWebSocketConcerns(servletContext); } finally { // Bug 20458755: The InitFacesContext was not being cleaned up, resulting in // a partially constructed FacesContext being made available // to other code that re-uses this Thread at init time. initFacesContext.releaseCurrentInstance(); initFacesContext.release(); } } }
private void handleMappingConcerns(ServletContext servletContext) throws ServletException { ServletRegistration existingFacesServletRegistration = getExistingFacesServletRegistration(servletContext); if (existingFacesServletRegistration != null) { // FacesServlet has already been defined, so we're // not going to add additional mappings; if (isADFApplication()) { // For Bug 21114997 and 21322338 add additional mappings existingFacesServletRegistration.addMapping("*.xhtml", "*.jsf"); } return; } ServletRegistration reg = servletContext.addServlet("FacesServlet", "javax.faces.webapp.FacesServlet"); if ("true".equalsIgnoreCase(servletContext.getInitParameter("javax.faces.DISABLE_FACESSERVLET_TO_XHTML")) ) { reg.addMapping("/faces/*", "*.jsf", "*.faces"); } else { reg.addMapping("/faces/*", "*.jsf", "*.faces", "*.xhtml"); } servletContext.setAttribute(FACES_INITIALIZER_MAPPINGS_ADDED, TRUE); // The following line is temporary until we can solve an ordering // issue in V3. Right now the JSP container looks for a mapping // of the FacesServlet in the web.xml. If it's not present, then // it assumes that the application isn't a faces application. In this // case the JSP container will not register the ConfigureListener // definition from our TLD nor will it parse cause or JSP TLDs to // be parsed. servletContext.addListener(com.sun.faces.config.ConfigureListener.class); }
if (shouldCheckMappings(classes, servletContext)) { InitFacesContext initFacesContext = new InitFacesContext(servletContext); if (null == initFacesContext) { if ( isADFApplication() ) {
private void handleMappingConcerns(ServletContext servletContext) throws ServletException { if (getExistingFacesServletRegistration(servletContext) != null) { // FacesServlet has already been defined, so we're not going to add additional mappings; return; } ServletRegistration facesServletRegistration = servletContext.addServlet("FacesServlet", FacesServlet.class.getName()); facesServletRegistration.addMapping("/faces/*", "*.jsf", "*.faces"); if (!"true".equalsIgnoreCase(servletContext.getInitParameter("javax.faces.DISABLE_FACESSERVLET_TO_XHTML")) ) { facesServletRegistration.addMapping("*.xhtml"); } servletContext.setAttribute(FACES_INITIALIZER_MAPPINGS_ADDED, TRUE); }
@Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { Set<Class<?>> annotatedClasses = new HashSet<Class<?>>(); if (classes != null) { annotatedClasses.addAll(classes); } servletContext.setAttribute(ANNOTATED_CLASSES, annotatedClasses); boolean appHasSomeJsfContent = appMayHaveSomeJsfContent(classes, servletContext); boolean appHasFacesServlet = getExistingFacesServletRegistration(servletContext) != null; if (appHasSomeJsfContent || appHasFacesServlet) { InitFacesContext initFacesContext = new InitFacesContext(servletContext); try { if (appHasSomeJsfContent) { // Only look at mapping concerns if there is JSF content handleMappingConcerns(servletContext); } // Other concerns also handled if there is an existing Faces Servlet mapping handleWebSocketConcerns(servletContext); } finally { // Bug 20458755: The InitFacesContext was not being cleaned up, resulting in // a partially constructed FacesContext being made available // to other code that re-uses this Thread at init time. initFacesContext.releaseCurrentInstance(); initFacesContext.release(); } } }
private void handleMappingConcerns(ServletContext servletContext) throws ServletException { ServletRegistration existingFacesServletRegistration = getExistingFacesServletRegistration(servletContext); if (existingFacesServletRegistration != null) { // FacesServlet has already been defined, so we're // not going to add additional mappings; if (isADFApplication()) { // For Bug 21114997 and 21322338 add additional mappings existingFacesServletRegistration.addMapping("*.xhtml", "*.jsf"); } return; } ServletRegistration reg = servletContext.addServlet("FacesServlet", "javax.faces.webapp.FacesServlet"); if ("true".equalsIgnoreCase(servletContext.getInitParameter("javax.faces.DISABLE_FACESSERVLET_TO_XHTML")) ) { reg.addMapping("/faces/*", "*.jsf", "*.faces"); } else { reg.addMapping("/faces/*", "*.jsf", "*.faces", "*.xhtml"); } servletContext.setAttribute(FACES_INITIALIZER_MAPPINGS_ADDED, TRUE); // The following line is temporary until we can solve an ordering // issue in V3. Right now the JSP container looks for a mapping // of the FacesServlet in the web.xml. If it's not present, then // it assumes that the application isn't a faces application. In this // case the JSP container will not register the ConfigureListener // definition from our TLD nor will it parse cause or JSP TLDs to // be parsed. servletContext.addListener(com.sun.faces.config.ConfigureListener.class); }
@Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { Set<Class<?>> annotatedClasses = new HashSet<Class<?>>(); if (classes != null) { annotatedClasses.addAll(classes); } servletContext.setAttribute(ANNOTATED_CLASSES, annotatedClasses); boolean appHasSomeJsfContent = appMayHaveSomeJsfContent(classes, servletContext); boolean appHasFacesServlet = getExistingFacesServletRegistration(servletContext) != null; if (appHasSomeJsfContent || appHasFacesServlet) { InitFacesContext initFacesContext = new InitFacesContext(servletContext); try { if (appHasSomeJsfContent) { // Only look at mapping concerns if there is JSF content handleMappingConcerns(servletContext); } // Other concerns also handled if there is an existing Faces Servlet mapping servletContext.addListener(ConfigureListener.class); handleWebSocketConcerns(servletContext); } finally { // Bug 20458755: The InitFacesContext was not being cleaned up, resulting in // a partially constructed FacesContext being made available // to other code that re-uses this Thread at init time. initFacesContext.releaseCurrentInstance(); initFacesContext.release(); } } }
@Override public ServletContainerInitializer getServletContainerInitializer() { if (this.servletContainerInitializer == null) { this.servletContainerInitializer = new FacesInitializer(); } return this.servletContainerInitializer; }