protected boolean pathsMatch(String path, ServletRequest request) {
        String requestURI = getPathWithinApplication(request);

        LOGGER.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI));
        boolean match = pathsMatch(path, requestURI);

        if (!match) {
            if (requestURI != null && !DEFAULT_PATH_SEPARATOR.equals(requestURI)
                    && requestURI.endsWith(DEFAULT_PATH_SEPARATOR)) {
                requestURI = requestURI.substring(0, requestURI.length() - 1);
            }
            if (path != null && !DEFAULT_PATH_SEPARATOR.equals(path)
                    && path.endsWith(DEFAULT_PATH_SEPARATOR)) {
                path = path.substring(0, path.length() - 1);
            }
            LOGGER.trace("Attempting to match pattern '{}' with current requestURI '{}'...", path, Encode.forHtml(requestURI));
            match = pathsMatch(path, requestURI);
        }

        return match;
    }
Returns <code>true</code> if the incoming <code>request</code> matches the specified <code>path</code> pattern,
<code>false</code> otherwise.
<p/>
The default implementation acquires the <code>request</code>'s path within the application and determines
if that matches:
<p/>
<code>String requestURI = {@link #getPathWithinApplication(ServletRequest) getPathWithinApplication(request)};<br/>
return {@link #pathsMatch(String, String) pathsMatch(path,requestURI)}</code>

@param path    the configured url pattern to check the incoming request against.
@param request the incoming ServletRequest
@return <code>true</code> if the incoming <code>request</code> matches the specified <code>path</code> pattern,
<code>false</code> otherwise.
web/src/main/java/org/apache/shiro/web/filter/PathMatchingFilter.java