Add mapping to "/rfRes/**" for RichFaces resources

Issue: SWF-1473
This commit is contained in:
Rossen Stoyanchev
2012-10-23 19:38:28 -04:00
parent 1418d4ef91
commit 3917dc71a3

View File

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.faces.webflow.JsfRuntimeInformation;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
import org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter;
@@ -31,7 +32,7 @@ import org.w3c.dom.Element;
/**
* Parser for the resources tag.
*
*
* @author Rossen Stoyanchev
* @author Phillip Webb
* @since 2.2.0
@@ -42,6 +43,10 @@ public class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
static final String PORTLET_RESOURCE_HANDLER_BEAN_NAME = "jsfPortletResourceRequestHandler";
private static final boolean RICH_FACES_PRESENT =
ClassUtils.isPresent("org.richfaces.application.CoreConfiguration",
ResourcesBeanDefinitionParser.class.getClassLoader());
public BeanDefinition parse(Element element, ParserContext parserContext) {
new ServletRegistrar(element, parserContext).register();
if (JsfRuntimeInformation.isSpringPortletPresent()) {
@@ -101,6 +106,10 @@ public class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
Map<String, String> urlMap = new ManagedMap<String, String>();
urlMap.put("/javax.faces.resource/**", SERVLET_RESOURCE_HANDLER_BEAN_NAME);
if (RICH_FACES_PRESENT) {
urlMap.put("/rfRes/**", SERVLET_RESOURCE_HANDLER_BEAN_NAME);
}
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleUrlHandlerMapping.class);
beanDefinition.setSource(source);
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);