private boolean isNormalized(String path) {
        if (path == null) {
            return true;
        }
        for (int i = path.length(); i > 0; ) {
            int slashIndex = path.lastIndexOf('/', i - 1);
            int gap = i - slashIndex;
            if (gap == 2 && path.charAt(slashIndex + 1) == '.') {
                // ".", "/./" or "/."
                return false;
            }
            if (gap == 3 && path.charAt(slashIndex + 1) == '.' && path.charAt(slashIndex + 2) == '.') {
                return false;
            }
            i = slashIndex;
        }
        return true;
    }
Checks whether a path is normalized (doesn't contain path traversal sequences like
"./", "/../" or "/.")

@param path the path to test
@return true if the path doesn't contain any path-traversal character sequences.
web/src/main/java/org/apache/shiro/web/filter/InvalidRequestFilter.java