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

[jsr344-experts] Re: [1142-ResourceLibraryContracts] How the property is calculated (was: [971-MultiTemplate])

From: Frank Caputo <frank_at_frankcaputo.de>
Date: Mon, 12 Nov 2012 21:05:23 +0100

Hi Ed,

Am 09.11.2012 um 23:12 schrieb Edward Burns <edward.burns_at_oracle.com>:

> CONDITIONALLY_RESOLVED: How are contracts made available to the
> application.
>
> This is where I bring in the syntax from Manfred I mentioned earlier.
>
> If we have a resource-library-contracts element in the application
> configuration resources, any mappings and contract declarations it has
> are added to the data structure of such things for the application.
>
> <faces-config>
>
> <resource-library-contracts>
> <mappings>
> <view pattern="" contracts="default1"/>
> <view pattern="/registration/*" contracts="default1, registration1"/>
> <view pattern="/welcome" contracts="welcome1"/>
> <view pattern="/print" contracts=""/>
> </mappings>
>
> <contracts>
> <contract id="default1" href="$CONTRACT_ROOT/default1"/>
> <contract id="registration1" href="$CONTRACT_ROOT/registration1"/>
> </contracts>
>
> </resource-library-contracts>
>
> </faces-config>
>
> The view element specifies which contracts are going to be available for
> a given pattern. The pattern attribute uses the same syntax as servlet
> mappings. The contracts attribute specifies a list of contracts to be
> applied in order. Note that if the contracts attribute is null or empty
> it means no templates will be applied.
>
> The contract element will specify what the id of the specific contract
> is going to be. Note that you are not required to use the contract
> element, If you do not specify a template (eg 'welcome1') the runtime
> will assume it is available from $CONTRACT_ROOT/welcome1
>
> If we do not have any <resource-library-contracts> elements in the
> application configuration resources, we scan the CONTRACT_ROOT for any
> available contracts and add them to the data structure of such things so
> that it is equivalet to having
>
> <resource-library-contracts>
> <mappings>
> <view pattern="*" contracts="[the names of all the contracts
> discovered by the startup scan]" />
> </mappings>
> </resource-library-contracts>

I still think, we don't need a configuration option, because possible use cases differ too much.

And as you said before: The JSF spec is already gigantic ;-)

>
> CONDITIONALLY_RESOLVED: Add new method on ViewDeclarationLanguage:
>
> public List<String> calculateResourceLibraryContracts(
> FacesContext context, String viewId);
>
> This method takes the argument viewId and uses the data structure to
> find the list of contracts that should be applied.

As stated in another mail: I'd like to have it on ViewHandler without the viewId.

Ciao Frank