Resolving resource
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