class HttpUtils {

    public static Map<String, String> parseUriPattern(String pattern, String url) {
        pattern = normaliseUriPath(pattern);
        url = normaliseUriPath(url);
        if (!pattern.contains("{") || !pattern.contains("}")) {
            return url.equals(pattern) ? Collections.emptyMap() : null;
        }
        UriTemplateParser templateParser = getUriParserForPattern(pattern);
        Matcher urlMatcher = templateParser.getPattern().matcher(url);
        if (urlMatcher.matches()) {
            if (templateParser.getGroupIndexes().length == 0) {
                return Collections.emptyMap();
            }
            Map<String, String> pathParams = new LinkedHashMap<>();
            int index = 0;
            for (String name : templateParser.getNames()) {
                String value = urlMatcher.group(templateParser.getGroupIndexes()[index]);
                if (name == null || pathParams.containsKey(name)) {
                    pathParams.put(name + "@" + (index + 1), value);
                } else {
                    pathParams.put(name, value);
                }
                index++;
            }
            return pathParams;
        }
        return null;
    }

    private  HttpUtils();

}