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

[jsr344-experts] Re: [1142-Contracts] False positives, are they a problem?

From: Frank Caputo <frank_at_frankcaputo.de>
Date: Sun, 18 Nov 2012 15:56:18 +0100

Hi Ed,

Am 16.11.2012 um 22:29 schrieb Edward Burns <edward.burns_at_oracle.com>:

> Hello Volunteers,
>
> I've made a permalink to the latest spec snapshot javadocs. No more
> having to go through the nexus UI.
>
> If the hudson jobs complete successfully, this gives you the absolute
> latest spec, updated nightly.
>
> http://jsf-spec.java.net/SNAPSHOT/javadoc/

Excellent!

> Considering that link, look at the JavaDoc for
> ResourceHandler.createViewResource(). I added this as a PENDING comment
> because I need an answer here, probably from Frank.
>
> PENDING(edburns): I think we need to put an additional check in to avoid
> returning false hits from this method when a viewResource happens to be
> named the same as one of the templates in a resource library
> contract. Perhaps we could set some kind of flag in the tag handler of
> all facelet tags that are valid for using resource library contracts
> (maybe just ui:composition and ui:decorate) and make it so the
> getResourceLibraryContracts part of this method only takes effect if
> that flag is set?
>
> Consider this scenario.
>
> webapp/
> contracts/
> siteLayout/
> fozzy.xhtml
> page1.xhtml
> fozzy.xhtml
>
> Assume siteLayout applies to the entire site.
>
> When you try to load <http://host/webapp/faces/fozzy.xhtml>
>
> I think the one from siteLayout will be picked up, and obviously that's
> not correct.
>
> To fix this, I think we should make it so the contract lookup mechanism
> is only honored if we are processing ui:composition or ui:decorate.
>
> What do you think?

I think, we should allow the "false" positives, because can be a huge benefit (one of my clients is actually using my implementation this way and with includes also). This is exactly what I wanted this feature to be ;-)

The developer should just be careful, how she configures the contracts or overrides calculateResourceLibraryContracts.

Ciao Frank