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

[jsr372-experts] getResourcePaths like method for ResourceResolver

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 27 Jul 2016 00:38:38 +0200

Hi,

The ServletContext has a method to acquire all paths to resources within a
web application; getResourcePaths().

In JSF resources are handled by the ResourceResolver. This has a method
createViewResource that takes a path and effectively returns a URL, just
like ServletContext has a getResource method taking a path and returning a
URL.

In both cases, the usage is to abstract the actual location of resources,
which could therefor transparently be on a local or remote filesystem, in a
database, custom jar location, or whatever.

The JSF specific ResourceResolver however does not have a
getResourcePaths() equivalent. I'd like to propose to rectify this by
introducing such method for JSF view resources.

Since we're targeting JDK 8 such method could take inspiration from
Files#walk (
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#walk-java.nio.file.Path-java.nio.file.FileVisitOption...-
)

At least one use case would be for something like the FaceViews feature in
OmniFaces, but I'd like to design this feature not just for that, of
course. Another use case for instance would be for help in debugging
(providing a list of all resources handled by the system could be handy to
check for omissions or unexpected entries)

Thoughts?

Kind regards,
Arjan Tijms