webtier@glassfish.java.net

Re: [webtier] JSF 2.0: Why do Resources become .jsf URLs?

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 13 Nov 2009 08:20:52 -0800

On 11/13/09 7:11 AM, webtier_at_javadesktop.org wrote:
> If I use
>
> &lt;h:graphicImage url="/resources/images/foo.gif"/&gt;
>
> it gets rendered as
>
> &lt;img src="/my-context/images/foo.gif" /&gt;
>
> But, if I use
>
> &lt;h:graphicImage name="foo.gif" library="images"/&gt;
>
> it gets rendered as
>
> &lt;img src="/my-context/javax.faces.resource/foo.gif.jsf?ln=images" /&gt;
>
> You get similar results for h:outputScript and h:outputStylesheet. What is the benefit of this second form? I don't see why it is needed to make resources relocatable. Is it just to make @ResourceDependency work? Or are there other benefits?
>
> Just curious...
>
The URL form:

/my-context/javax.faces.resource/foo.gif.jsf?ln=images


Will cause the FacesServlet to be triggered and then hand off that
request to the ResourceHandler to serve the
resource. When going through the ResourceHandler you have the
following features:

    - resource versioning for resources included in the doc root
    - resources can be served from the classpath


> - Marty
> http://www.coreservlets.com/JSF-Tutorial/jsf2/
> [Message sent by forum member 'martyhall' ]
>
> http://forums.java.net/jive/thread.jspa?messageID=371727
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>