String delegateFacesServlet = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(),
INIT_PARAM_DELEGATE_FACES_SERVLET);
for (Map.Entry<String, ? extends ServletRegistration> entry : webRegistration.getServletRegistrations().entrySet())
{
ServletRegistration registration = entry.getValue();
boolean facesServlet = false;
if (FacesServlet.class.getName().equals(registration.getClassName()))
{
facesServlet = true;
}
else if (delegateFacesServlet != null && delegateFacesServlet.equals(registration.getClassName()))
{
facesServlet = true;
}
else
{
if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS != null)
{
try
{
Class servletClass = ClassUtils.classForName(registration.getClassName());
if (DELEGATE_FACES_SERVLET_INTERFACE_CLASS.isAssignableFrom(servletClass));
{
facesServlet = true;
}
}
catch (ClassNotFoundException e)
{
Log log = LogFactory.getLog(ExtendedDefaultResourceHandlerSupport.class);
if (log.isTraceEnabled())
{
log.trace("cannot load servlet class to detect if is a FacesServlet or DelegateFacesServlet", e);
}
}
}
}
if (facesServlet)
{
for (String urlPattern : registration.getMappings())
{
String extension = urlPattern != null && urlPattern.startsWith("*.") ? urlPattern.substring(urlPattern
.indexOf('.')) : null;
if (extension == null)
{