private static String getRootPath(final String locationPattern) {

        int rootDirEnd = locationPattern.length();

        while (AntPathMatcher.isPattern(locationPattern.substring(0, rootDirEnd))) {
            rootDirEnd = locationPattern.lastIndexOf('/', rootDirEnd - 2) + 1;
        }
        return locationPattern.substring(0, rootDirEnd);
    }
private static String getRootPath ( final String locationPattern ) { int rootDirEnd = locationPattern . length ( ) ; while ( AntPathMatcher . isPattern ( locationPattern . substring ( 0 , rootDirEnd ) ) ) { rootDirEnd = locationPattern . lastIndexOf ( '/' , rootDirEnd - 2 ) + 1 ; } return locationPattern . substring ( 0 , rootDirEnd ) ; }
get rootPath from locationPattern.
<p>
if "/context/** / *.xml" should get the result "/context/"
</p>

@param locationPattern locationPattern
@return the RootPath string.