jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: Url mapping

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Tue, 11 Nov 2014 16:52:22 +0100

Hi,

On Mon, Nov 10, 2014 at 11:42 PM, Edward Burns <edward.burns_at_oracle.com> wrote:
>>>>>> On Tue, 4 Nov 2014 12:50:09 +0100, Frank Caputo <frank_at_frankcaputo.de> said:
>
> FC> we should provide some Java API, where one can register
> FC> programmatically the mappings. This API can then be called, by the
> FC> custom ResourceHandler.
>
> How would this differ from what we have in the Mojarra FacesInitializer
> [1]? It uses the existing ServletRegistration.addMapping()?

I think the difference should be that ServletRegistration.addMapping()
is actually the low level mechanism to do the URL mapping (URL to
FacesServlet). I don't think a ResourceHandler should attempt to do
this kind of mapping.

A ResourceHandler does do -a- mapping, namely from a resource name to
an actual (view) resource (i.e. in case of a view resource the lines
of XML of which a Facelet consists). So practically speaking a
ResourceHandler can "map" from "foo.xhtml" to "bar.xhtml", where
bar.xhtml could be on the file system, but could just as well be
retrieved from a jar, database, ftp server, etc.

For the URL mapping, the only thing that matters are the names a
ResourceHandler accepts, which is thus "foo.xhtml" in the example
above. The "bar.xhtml" is of course completely irrelevant as far as
URL mapping is concerned.

Whether the resource handler pushes the list of names it accepts at
initialization time to some central JSF repository, which the URL
mapping system then uses, or whether the URL mapping system goes out
to ask every active ResourceHandler for this list is perhaps less
important. That said, I think I would prefer the ResourceHandler being
asked for it.

Keep in mind that there's a small window during startup when
ServletRegistration.addMapping() is a valid operation, so the required
information needs to be available early as well.

Kind regards,
Arjan










>
> Ed
>
>
>
> [1] http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish/javax.faces/2.1.7/com/sun/faces/config/FacesInitializer.java
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | 0 work days til Devoxx 2014