更新时间:2023-01-14 14:37:45
这就是:
String format = "location/{state}/{city}";
String actualUrl = "location/washington/seattle";
AntPathMatcher pathMatcher = new AntPathMatcher();
Map<String, String> variables = pathMatcher.extractUriTemplateVariables(format, actualUrl);
assertThat(variables.get("state"), is("washington"));
assertThat(variables.get("city"), is("seattle"));