users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: [947-RelativeResources] Jakob Korherr: please break my sample

From: Edward Burns <edward.burns_at_oracle.com>
Date: Tue, 20 Mar 2012 13:30:40 -0700

>>>>> On Sun, 4 Mar 2012 16:54:44 +0100, Jakob Korherr <jakob.korherr_at_gmail.com> said:

LU> In theory with servlet 3.0, use prefix mapping only to handle resource
LU> shouldn't be a problem, because you can register it automatically. For
LU> example, if you are using suffix mapping, shouldn't be valid to
LU> register /javax.faces.resource as prefix mapping? It sounds limiting
LU> but only for servlet 2.5, but isn't just add some few lines on web.xml
LU> only in that case so difficult?.

JK> This is a very good idea, Leo! Actually we could even go as far as
JK> "forcing" the developer to add a prefix mapping for the
JK> ResourceHandler in a servlet 2.5 environment, and automatically adding
JK> it (if not already present) in a servlet 3.0 environment.

I like the idea also. Good to save a few bytes in the URL too.

But, Jakob, I have a question, which I posted to the issue and copy
here.

8<------------------------------

A resource path from Jakob's impl looks like
"/javax.faces.resource/1.0.0/en_US/css/style.css". Does that 1.0.0
refer to library version or resource version?

Here's a clue, from RelativeResourceHandler#132.

// skip version in url (first part, only there to avoid cache problems
// on updates)

final int versionSlash = resourceName.indexOf('/');

But that still doesn't answer my question. What does the 1.0.0 mean?

JK> The need to have the libraryName configured in
JK> relative-resources.xml does only exist, because I needed a way to
JK> enable the RelativeResourceHandler only for certain libraries. This
JK> would not be necessary if the standard ResourceHandler already uses
JK> the "relative-mechanism" (for all libraries).

Ok, let's say we make relative libraries the default for prefix mapped
applications. If we have a jar in the classpath that contains a library
that is arranged according to the JSF 2.0 spec for resource libraries,
we now we need some way to detect that case and use the JSF 2.0 style
arrangement, right?

Ed