sâmbătă, 18 aprilie 2015

[OmniFaces utilities (2.0)] Get a set of available application resource paths matching the specified path


[OmniFaces utilities] The getResourcePaths() method returns a set of available application resource paths matching the specified path.

Method:

See also: Faces#getContext()
Usage:

For example, let's suppose that we have a /resources folder with the structure from figure below:
Now, let's see the two examples of using Faces#getResourcePaths() utility method:

import org.omnifaces.util.Faces;
import java.util.Set;
...
Set<String> paths = Faces.getResourcePaths("/resources/default/");

The paths will contain the following paths:
[/resources/default/css/, /resources/default/video/, /resources/default/images/]

And, another example:

import org.omnifaces.util.Faces;
import java.util.Set;
...
Set<String> paths = Faces.getResourcePaths("/resources/");

The paths will contain the following paths:
[/resources/default/, /resources/engines/, /resources/templates/]

Niciun comentariu:

Trimiteți un comentariu