public final class ServerDirectoryHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Pattern |
DYNAMIC_PATH_PATTERN |
| Modifier | Constructor and Description |
|---|---|
private |
ServerDirectoryHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
evaluateDynamicPath(String path,
String siteName,
String language,
UserIdentity currentUser)
Evaluate a dynamic path with contextual variables
|
static Set<String> |
getRootServerDirectoryPaths()
Get the paths of the server directories' roots
|
static Set<Source> |
getRootServerSources(SourceResolver sourceResolver)
Get the sources corresponding to the roots of the defined server directories
|
static boolean |
isValidPath(String path,
Set<Source> rootSources)
Check if the given path is a valid path for a root of a server directory
|
static String |
normalize(String path)
Normalizes a path, removing double and single dot path steps and replace '\' by '/'
|
private static final Pattern DYNAMIC_PATH_PATTERN
private ServerDirectoryHelper()
public static Set<Source> getRootServerSources(SourceResolver sourceResolver) throws ProcessingException
sourceResolver - the source resolverProcessingException - if the sever directory's location wasn't foundpublic static Set<String> getRootServerDirectoryPaths()
public static String normalize(String path)
path - The pathpublic static boolean isValidPath(String path, Set<Source> rootSources)
path - the path to checkrootSources - the sources corresponding to the server directories' rootspublic static String evaluateDynamicPath(String path, String siteName, String language, UserIdentity currentUser) throws AuthorizationRequiredException, AccessDeniedException, IllegalArgumentException
path - The dynamic pathsiteName - The current site namelanguage - The current site languagecurrentUser - The current userAuthorizationRequiredException - If the current user is null and the path required the loginAccessDeniedException - If the connected user does not belong to required populationIllegalArgumentException - If a dynamic variable can not be evaluated