https://issues.apache.org/bugzilla/show_bug.cgi?id=56512

Konstantin Kolinko <knst.koli...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Konstantin Kolinko <knst.koli...@gmail.com> ---
(In reply to j__n from comment #0)
> I was looking for what patterns are valid for url-pattern, and I was unable
> to find any official documentation, so I went to the source:

The code in ApplicationFilterFactory.matchFiltersURL(String, String) is

[[[
        // Case 2 - Path Match ("/.../*")
        if (testPath.equals("/*"))
            return (true);
        if (testPath.endsWith("/*")) {
            if (testPath.regionMatches(0, requestPath, 0,
                                       testPath.length() - 2)) {
                if (requestPath.length() == (testPath.length() - 2)) {
                    return (true);
                } else if ('/' == requestPath.charAt(testPath.length() - 2)) {
                    return (true);
                }
            }
            return (false);
        }
]]]

"testPath.length() - 2" is url-pattern minus ending "/*".

The first "if (requestPath.length() == (testPath.length() - 2))" covers the
case when request uri is equal to pattern.substring(0, pattern.length()-2).

The second "if ('/' == requestPath.charAt(testPath.length() - 2))" covers the
case when request uri starts with (pattern.substring(0, pattern.length()-2) +
'/').

I see no error here.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to