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

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

From: arjan tijms <arjan.tijms_at_gmail.com>
Date: Wed, 27 Jul 2016 15:10:16 +0200

Hi,

On Wednesday, July 27, 2016, Kito Mann <kito.mann_at_virtua.com> wrote:

> Thanks!
>
> I vote +1. This could be handy in cases where you want to return several
> resources from a special location (such as a database).
>

Indeed, FacesViews is one feature that likes to know what views there are.
It used the standard Servlet API now, but it would break when people have
installed special ResourceHandlers that load views from indeed a database.

The same holds for every other feature or even application code that works
by looking at what views there are.

Kind regards,
Arjan Tijms


>
> ___
>
> Kito D. Mann | @kito99 | Author, JSF in Action
> Web Components, Polymer, JSF, PrimeFaces, Java EE, and Liferay training
> and consulting
> Virtua, Inc. | virtua.tech
> JSFCentral.com | @jsfcentral | knowesis.io
> <http://knowesis.io/web/webcomponents> - fresh Web Components info
> +1 203-998-0403
>
> * Listen to the Enterprise Java Newscast: *http://
> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
> <http://ww.enterprisejavanews.com>*
>
>
> On Wed, Jul 27, 2016 at 7:05 AM, Bauke Scholtz <balusc_at_gmail.com
> <javascript:_e(%7B%7D,'cvml','balusc_at_gmail.com');>> wrote:
>
>> See http://showcase.omnifaces.org/facesviews/ExtensionlessURLs
>>
>> Cheers, B
>>
>> On Wed, Jul 27, 2016 at 1:02 PM, Kito Mann <kito.mann_at_virtua.com
>> <javascript:_e(%7B%7D,'cvml','kito.mann_at_virtua.com');>> wrote:
>>
>>> Hello Arjan,
>>>
>>> Can you explain the FaceViews feature in OmniFaces?
>>>
>>> ___
>>>
>>> Kito D. Mann | @kito99 | Author, JSF in Action
>>> Web Components, Polymer, JSF, PrimeFaces, Java EE, and Liferay training
>>> and consulting
>>> Virtua, Inc. | virtua.tech
>>> JSFCentral.com | @jsfcentral | knowesis.io
>>> <http://knowesis.io/web/webcomponents> - fresh Web Components info
>>> +1 203-998-0403
>>>
>>> * Listen to the Enterprise Java Newscast: *http://
>>> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
>>> <http://ww.enterprisejavanews.com>*
>>>
>>>
>>> On Tue, Jul 26, 2016 at 6:38 PM, arjan tijms <arjan.tijms_at_gmail.com
>>> <javascript:_e(%7B%7D,'cvml','arjan.tijms_at_gmail.com');>> wrote:
>>>
>>>> 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
>>>>
>>>
>>>
>>
>