Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
You can’t perform that action at this time.