Hello Stephen,
With JSF 2, you can use the resource handling mechanism to load resources
from META-INF/resources -- this works for composite components, images, etc.
If you want to serve .xhtml files from a JAR, you need to write a custom
ResourceResolver, which is a trivial exercise. See:
http://ocpsoft.com/opensource/create-common-facelets-jar/.
---
Kito D. Mann | twitter: kito99 | Author, JSF in Action
Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter:
jsfcentral
+1 203-404-4848 x3
* Listen to the latest headlines in the JSF and Java EE newscast:
http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast
* See you at JAX and JSF Summit 2010 June 20-23rd in San Jose:
http://jaxconf.com/
On Fri, Mar 4, 2011 at 11:45 AM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:
> Hi,
>
> Just a quick question as I am doing some research.
>
> I cannot remember (and my google searches are just turning up far far too
> much noize) whether it is possible to server content directly from jars on
> the classpath rather than only from the wars.
>
> I'm thinking of a case where you might have a plugin mechanism, or a core
> functionality and you want to be able to merge that into your web
> application without expanding the jar file as a war overlay.
>
> I cannot recall if I only dreamt reading that you could do the following,
> or
> if you actually can.
>
> Jar would look something like:
>
> /
> com
> somecompany
> ...
> META-INF
> faces-config.xml
> content
> plugin.xhtml
>
> And then if the webapp had that jar on the classpath, a request for
> /contextRoot/plugin.xhtml would server the content from the jar file and
> not
> bomb out because the file does not exist in the war file itself.
>
> -Stephen
>
|