Created
May 18, 2019 09:07
-
-
Save cx0der/c1aa309bce4bb48e1142ddbf72f11fac to your computer and use it in GitHub Desktop.
Resolving resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String resolveResource(String requestedPath) { | |
Path resolvedPath = FileSystems.getDefault().getPath(""); | |
Path other = FileSystems.getDefault().getPath(requestedPath); | |
for (Path path : other) { | |
if (!path.startsWith(".") && !path.startsWith("..")) { | |
resolvedPath = resolvedPath.resolve(path); | |
} | |
} | |
if (resolvedPath.startsWith("")) { | |
resolvedPath = resolvedPath.resolve(INDEX_HTML); | |
} | |
return resolvedPath.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment