Hello Volunteers,
This email thread will resolve how the value of the
resourceLibraryContracts property is calculated. There are two other
threads, one that resolves the name of the property for storing the
resource library contracts, and when and where the value of that
property is set, and another regarding *how* the value of the property
is used.
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>
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.
Manfred has discovered some important corner cases, but I'll wait til
some discussion happens to determine if I need to introduce them here.
ACTION: Please reply by 17:00 GMT Tuesday 20121113, earlier if you can manage!
Thanks,
Ed
--
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage: | http://ridingthecrest.com/