private WebConfigProvider resolveWebXmlProviderFromService( ExternalContext externalContext) throws ClassNotFoundException, NoClassDefFoundError, InstantiationException, IllegalAccessException, InvocationTargetException, PrivilegedActionException { List<String> classList = (List<String>) externalContext.getApplicationMap().get(WEB_CONFIG_PROVIDER_LIST); if (classList == null) { classList = ServiceProviderFinderFactory.getServiceProviderFinder(externalContext).getServiceProviderList(WEB_CONFIG_PROVIDER); externalContext.getApplicationMap().put(WEB_CONFIG_PROVIDER_LIST, classList); } return ClassUtils.buildApplicationObject(WebConfigProvider.class, classList, new DefaultWebConfigProvider()); }
@Override public List<ServletMapping> getFacesServletMappings(final ExternalContext externalContext) { final List<ServletMapping> facesServletMappings = super.getFacesServletMappings(externalContext); try { // getContext() is a runtime object where getServletRegistrations() is forbidden so unwrap final ServletContext sc = ServletContext.class.cast(Reflections.get(externalContext.getContext(), "sc")); if (sc != null && sc.getServletRegistrations() != null) { for (final Map.Entry<String, ? extends ServletRegistration> reg : sc.getServletRegistrations().entrySet()) { final ServletRegistration value = reg.getValue(); if ("javax.faces.webapp.FacesServlet".equals(value.getClassName())) { for (final String mapping : value.getMappings()) { final Class<?> clazz = sc.getClassLoader().loadClass(value.getClassName()); final org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping mappingImpl = new org.apache.myfaces.shared_impl.webapp.webxml.ServletMapping( value.getName(), clazz, mapping); facesServletMappings.add(new ServletMappingImpl(mappingImpl)); } } } } else { facesServletMappings.addAll(super.getFacesServletMappings(externalContext)); } } catch (final Exception e) { // don't fail cause our cast failed facesServletMappings.clear(); facesServletMappings.addAll(super.getFacesServletMappings(externalContext)); } return facesServletMappings; } }
private WebConfigProvider resolveWebXmlProviderFromService( ExternalContext externalContext) throws ClassNotFoundException, NoClassDefFoundError, InstantiationException, IllegalAccessException, InvocationTargetException, PrivilegedActionException { List<String> classList = (List<String>) externalContext.getApplicationMap().get(WEB_CONFIG_PROVIDER_LIST); if (classList == null) { classList = ServiceProviderFinderFactory.getServiceProviderFinder(externalContext).getServiceProviderList(WEB_CONFIG_PROVIDER); externalContext.getApplicationMap().put(WEB_CONFIG_PROVIDER_LIST, classList); } return ClassUtils.buildApplicationObject(WebConfigProvider.class, classList, new DefaultWebConfigProvider()); }
private WebConfigProvider resolveWebXmlProviderFromService( ExternalContext externalContext) throws ClassNotFoundException, NoClassDefFoundError, InstantiationException, IllegalAccessException, InvocationTargetException, PrivilegedActionException { List<String> classList = (List<String>) externalContext.getApplicationMap().get(WEB_CONFIG_PROVIDER_LIST); if (classList == null) { classList = ServiceProviderFinderFactory.getServiceProviderFinder(externalContext). getServiceProviderList(WEB_CONFIG_PROVIDER); externalContext.getApplicationMap().put(WEB_CONFIG_PROVIDER_LIST, classList); } return ClassUtils.buildApplicationObject(WebConfigProvider.class, classList, new DefaultWebConfigProvider()); }