public class Path extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
normalizeAlias(String alias)
Alias should always be "exact" path
|
static String |
normalizePattern(String pattern)
Normalizes a pattern = prepends the path with slash (/) if the path does
not start with a slash.
|
static String[] |
normalizePatterns(String[] urlPatterns)
Normalize an array of patterns.
|
static String |
normalizeResourcePath(String path)
Normalize the path for accesing a resource, meaning that will replace
consecutive slashes and will remove a leading slash if present.
|
static String |
replaceSlashes(String target)
Replaces multiple subsequent slashes with one slash.
|
static String |
securePath(String path)
Make passed path securely appendable to some resource base path.
|
public static String normalizeResourcePath(String path)
path - path to normalizepublic static String securePath(String path)
Make passed path securely appendable to some resource base path. Resource base path may (but doesn't have to) be a String with trailing slash - the only requirement is that it should mean a base directory or chroot that can't be escaped.
The returned path may, but doesn't have to end with "/" which could be treated as file vs. directory distinction.
If null is returned, it means that path is invalid and/or it goes out of the chroot.
path - public static String replaceSlashes(String target)
target - target sring to be replacedpublic static String[] normalizePatterns(String[] urlPatterns)
urlPatterns - to mormalizepublic static String normalizePattern(String pattern)
pattern - to normalizeCopyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.