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

[jsr372-experts] Re: 1099-ViewsInDedicatedFolder

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Tue, 3 Feb 2015 17:36:40 +0100

Hi,

On Tue, Feb 3, 2015 at 4:22 PM, Frank Caputo <frank_at_frankcaputo.de> wrote:
> /contracts can have any resource, thus it can have top level views. From a technical perspective a view is just a facelet. Currently a view can be replaced in a contract.

Okay, so I was mistaken there then. Thanks for the correction.

But isn't this a problem then? All examples and actually the spec
itself refers to it as a "resource library", and saying that it
contains files that would otherwise reside within the resources
directory (which default to /resources).

The spec specifically says in 2.7:

"A resource library contract is a resource library, as specified in
the preceding section,
except that *instead of residing in the resources directory* of the
web-app root, or in the META-INF/resources
JAR entry name in a JAR file, it resides in the contracts directory of
the web-app root, or in the META-
INF/contracts JAR entry name in a JAR file." (emphasis mine)

If I now have the following structure:

WebRoot
   contracts
      contract1
          test.xhtml (with output "contract file")
   test.xhtml (with output "root file")
  WEB-INF
      faces-config.xml (empty)

and request say localhost:8080/test.jsf then it outputs "contract file".

However, if I have the following structure:

WebRoot
   resources
       test.xhtml (with output "resource file")
   test.xhtml (with output "root file")
  WEB-INF
      faces-config.xml (empty)

and request localhost:8080/test.jsf again then it outputs "root file".

So I would say that the spec text is perhaps not entirely correct, as
contracts do not just serve files that would otherwise reside within
/resources?

The same holds for templates of course, which can't normally be served
from /resources either, but that is, more or less, explained in
10.1.3:

"A configurable set of Facelet VDL views in the application will be
able to declare themselves to be template-clients of any template in a
resource library contract."

The same section also says:

"When useContract.war is deployed, the runtime will discover that
siteLayout.jar is a resource library contract
and make its contents available for template clients."

So here it explicitly says that the content is made available to
*template clients*. It doesn't speak about those files becoming
available as top-level views.

To sum up, I looks like 2.7 is potentially not entirely consistent
with 10.1.3, and both do not mention anywhere that views in contract
may be top-level views as well (but I could of course have missed
something).

What do you think?

Kind regards,
Arjan Tijms







>
> Ciao Frank
>