title: Resource Handler problems with JSF2 + Richfaces4 + SpringMVC + WebFlow (SWF)
body: <p>I've been trying to get the above mentioned setup working for days now with minimal success.  My issues appears to be with the resource handler.  Ie. </p>
  
  <pre><code>&lt;h:outputStylesheet name="header.css" library="page"/&gt;
  </code></pre>
  
  <p>does not work, NOR can RichFaces resolve any of the resources it uses internally. So i've done some investigating and the tag above should be resolving to "/project/javax.faces.resource/header.css?ln=page" but it is not. 2 obvious issues are occuring.  </p>
  
  <p>1) Something in the Resource Handler chain, possibly the richfaces handler, is expecting a ".jsf" suffix to be added to the requested url, which does happen when using the old EXTERNAL facelets w/ JSF2 &amp; RichFaces 3.3.x, but with Richfaces 4 &amp; builtin facelets that doesn't take place.  As a result, one of the handlers (RichFaces' I believe) is stripping the .css suffix off thinking it's an extra suffix like how it used to work. (Consequently this causes missing MIME type errors)</p>
  
  <p>2) When the library &amp; name attributes are resolved, the are resolved under the current path instead of the servlet context root.  Ie.  it should be resolving to  "/project/javax.faces.resource/..." but instead it resolves to "/project/index/javax.faces.resource/..." when viewing a page in the /index directory.</p>
  
  <p>Can anyone please give me some insight here?  I'm banging my head against the wall on this one &amp; not making any real ground.</p>
  
  <p>btw here is my basic config....</p>
  
  <p><strong>faces-config.xml</strong></p>
  
  <pre><code>&lt;application&gt;
      &lt;el-resolver&gt;org.springframework.web.jsf.el.SpringBeanFacesELResolver&lt;/el-resolver&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;Spring MVC Servlet&lt;/servlet-name&gt;
  
  &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/appServlet/servlet-context.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Spring MVC Servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p><strong>servlet-context.xml</strong></p>
  
  <pre><code>&lt;beans:bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;beans:property name="viewClass" value="org.springframework.faces.mvc.JsfView"/&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/content/" /&gt;
      &lt;beans:property name="suffix" value=".xhtml" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"&gt;
          &lt;beans:property name="order" value="2"/&gt;
          &lt;beans:property name="flowRegistry" ref="flowRegistry" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"&gt;
      &lt;beans:property name="flowExecutor" ref="flowExecutor" /&gt;
      &lt;beans:property name="ajaxHandler"&gt;
          &lt;beans:bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler"/&gt;
      &lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;beans:property name="viewClass" value="org.springframework.faces.mvc.JsfView"/&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/content/" /&gt;
      &lt;beans:property name="suffix" value=".xhtml" /&gt;
  &lt;/beans:bean&gt;
  
  
  &lt;beans:bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /&gt;
  &lt;beans:bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt;
      &lt;beans:property name="order" value="3" /&gt;
      &lt;beans:property name="alwaysUseFullPath" value="true" /&gt;
      &lt;beans:property name="mappings"&gt;
          &lt;beans:value&gt;
          &lt;/beans:value&gt;
      &lt;/beans:property&gt;
      &lt;beans:property name="defaultHandler"&gt;
          &lt;beans:bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" /&gt;
      &lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p><strong>webflow-config.xml</strong></p>
  
  <pre><code>&lt;faces:resources/&gt;
  
  &lt;beans:bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/&gt;
  
  &lt;flow-executor id="flowExecutor"&gt;
      &lt;flow-execution-listeners&gt;
          &lt;listener ref="facesContextListener"/&gt;
      &lt;/flow-execution-listeners&gt;
  &lt;/flow-executor&gt;
  
  &lt;flow-registry id="flowRegistry" base-path="/WEB-INF/content" flow-builder-services="flowBuilderServices"&gt;
      &lt;flow-location-pattern value="/**/flow.xml" /&gt;
  &lt;/flow-registry&gt;
  
  &lt;flow-builder-services id="flowBuilderServices" development="true" /&gt;
  </code></pre>