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

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

From: Bauke Scholtz <balusc_at_gmail.com>
Date: Wed, 27 Jul 2016 15:38:42 +0200

+1 only if it's visitable/filterable a la Files#walk

Cheers, B

On Wed, Jul 27, 2016 at 3:27 PM, arjan tijms <arjan.tijms_at_gmail.com> wrote:

> Hi,
>
> On Wednesday, July 27, 2016, Leonardo Uribe <leonardo.uribe_at_irian.at>
> wrote:
>
>> 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.
>>
>
> Practically speaking indeed. I wrote about that here:
> http://jdevelopment.nl/jsf-22/#809
>
> Theoretically speaking I think the spec doesn't require this, does it?
>
>
>> There is nothing to scan for (possible) view resources or templates, but
>> I suppose this feature should modify ResourceHandler instead
>> ResourceResolver.
>>
>
> For the best compatibility we may have to involve the ResourceResolver.
> The primary change would be adding the method to ResourceHandler though.
>
> Kind regards,
> Arjan Tijms
>
>
>
>> 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
>>>
>>
>>