On Fri, 2006-01-20 at 14:04 +0000, Hendrik Neumann wrote:
> Hi List,
> 
> I have developed a bunch of JSF-Components which uses some
> JavaScript-Codes (about 10 *.js-files). Now I have written an Apache
> Maven Script which builds a mycomponents.jar file (containing
> everything needed to use the components) which can simply be copied
> into the lib-Folder of any other web-application.
> 
> My problem: This jar-file contains my javascript-files but what is the
> most compfortable way to serve the script-files to the
> client-browsers? How do you MyFaces-guys solve this problem? What
> would be the best way to do it?

This problem needs no solution for core JSF components because none of
them require complicated script; any script used is inline.

It's solved in Tomahawk via the AddResources and ExtensionsFilter
classes working in partnership. Classes call AddResources to "queue"
script references needed in the page; the ExtensionsFilter buffers the
entire page output and calls back into AddResources when the page is
complete to allow that class to insert the queued references into the
appropriate parts of the html page via a special URL
"{contextPath}/faces/myFacesExtensionResource/..." which must also be
mapped to the ExtensionsFilter. This then locates the desired file
within the classpath and serves it up.

The javadoc on org.apache.myfaces.component.html.util.AddResource
describes how this works in detail.

ExtensionsFilter has javadoc but there is also info here:
  http://myfaces.apache.org/tomahawk/extensionsFilter.html

Regards,

Simon

Reply via email to