private boolean pathMatches(String cookiePath, String requestPath) {
        if (!requestPath.startsWith(cookiePath)) {
            return false;
        }

        return requestPath.length() == cookiePath.length()
                || cookiePath.charAt(cookiePath.length() - 1) == '/'
                || requestPath.charAt(cookiePath.length()) == '/';
    }
Check whether the given {@code cookiePath} matches the {@code requestPath}

@param cookiePath  cookiePath
@param requestPath requestPath
@return boolean
@see <a href="https://tools.ietf.org/html/rfc6265#section-5.1.4">RFC 6265, Section 5.1.4 "Paths and Path-Match"</a>
web/src/main/java/org/apache/shiro/web/servlet/SimpleCookie.java