title: JSF: Serving Resources From a Jar
body: <p>I´m in the process to create a couple of jars packed with facelets templates for usage through the organisation.</p>
  
  <p>Stuck in JSF 1.2 this functionality does not come out of the box.
  Stack:</p>
  
  <ul>
  <li>Jboss EAP 5.1</li>
  <li>Seam 2.2</li>
  <li>Richfaces 3.3.3</li>
  </ul>
  
  <p>It seems to me that I primarily need two resources:</p>
  
  <ol>
  <li>Resource resolver that finds Faclets resources</li>
  <li>A thing that serve css and js resources from a jar</li>
  </ol>
  
  <p>Resource resolver seems to be the easy part:
  <a href="http://ocpsoft.org/opensource/create-common-facelets-jar/" rel="nofollow">http://ocpsoft.org/opensource/create-common-facelets-jar/</a></p>
  
  <p>The thing that streams css / js is slightly more complicated:
  <strong>JSF: Serving Resources From a Jar</strong>
  <a href="http://cagataycivici.wordpress.com/2006/05/09/jsf_serving_resources_from_a/" rel="nofollow">http://cagataycivici.wordpress.com/2006/05/09/jsf_serving_resources_from_a/</a></p>
  
  <ul>
  <li>Phaselistener</li>
  <li>Filter</li>
  <li>Servlet</li>
  <li>Weblets</li>
  </ul>
  
  <p>I would very much like to use Weblets as it seems to be project dedicated to solve this problem. Furthermore it is recommended in this cool JSF book i bought: "Pro JSF and Ajax
  Building Rich Internet Components"</p>
  
  <p><strong>The problem is that I can not find a stable release in any Maven repo and no documentation. In the example no faclets is not used:</strong></p>
  
  <p><a href="https://github.com/werpu/weblets" rel="nofollow">https://github.com/werpu/weblets</a></p>
  
  <p>In the article above a Filter is highlighted as a good solution.
  <a href="http://myfaces.apache.org/tomahawk-project/tomahawk/apidocs/org/apache/myfaces/webapp/filter/ExtensionsFilter.html" rel="nofollow">http://myfaces.apache.org/tomahawk-project/tomahawk/apidocs/org/apache/myfaces/webapp/filter/ExtensionsFilter.html</a></p>
  
  <p>Sadly it is not a simple task to hook in to this solution. I simply do not have the time (or knowledge at the moment) :(</p>
  
  <p>Possible I can use this project: <a href="http://jawr.java.net/introduction.html" rel="nofollow">http://jawr.java.net/introduction.html</a>
  Jawr aims to bundle js and css files.</p>
  
  <p>The project wiki indicates that it could be possible:
  <a href="http://jawr.java.net/docs/generators.html" rel="nofollow">http://jawr.java.net/docs/generators.html</a> see the "classpath resource generator" section.</p>
  
  <p>Please advice :)</p>