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

[jsr372-experts] Re: getResourcePaths like method for ResourceResolver

From: Leonardo Uribe <leonardo.uribe_at_irian.at>
Date: Tue, 26 Jul 2016 19:29:19 -0500

Hi

Just some small comments. There is a method called
ResourceHandler.createViewResource(...) that returns a ViewResource
instance, which is an interface with a method getURL(). This call
ResourceResolver internally.

There is nothing to scan for (possible) view resources or templates, but I
suppose this feature should modify ResourceHandler instead ResourceResolver.

regards,

Leonardo Uribe

2016-07-26 17:38 GMT-05:00 arjan tijms <arjan.tijms_at_gmail.com>:

> 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
>