我有这样的uriTemplate
/{repository}/{id}/action/{methodName}/**org.springframework.data.rest.webmvc.util.UriUtils使用org.springframework.web.util.UriTemplate获取findMappingVariable方法中的变量
将UriTemplate.Parser构建模式设置为此值
\Q/\E(.*)\Q/\E(.*)\Q/action/\E(.*)\Q/**\E为什么不这样做呢?
\\Q/\\E(.*)\\Q/\\E(.*)\\Q/action/\\E(.*)\\Q/\\E(.*)\\Q\\E由于此功能,我在那里有一个空地图
Map<String, String> variables = new org.springframework.web.util.UriTemplate(mapping).match(lookupPath);对于此lookupPath
/educationDistrict/308/action/resetAddressesForYear/1发布于 2015-03-21 20:34:29
我不认为URI模板中允许使用**段。在这种情况下,如果**部分匹配多个数据段,那么在获取路径变量时会发生什么?
请注意,如果您试图构建模板以便进行REST调用,则应该检查RestTemplate和UriComponentsBuilder (see reference doc)。
发布于 2020-06-12 16:57:50
如果你想要一个匹配正则表达式的UriTEmplate,你可以使用它{:},例如,
/test-service/test-endpoint/countries/1/cities/2
/test-service/test-endpoint/people/5/adults/6
可以与UriTemplate 分别匹配。
/test-service/test-endpoint/countries/{id}/cities/{id}
/test-service/test-endpoint/people/{id}/adults/{id}
如果您想同时匹配和
/test-service/test-endpoint/{:.*}

以下是链接
URI template needs to match with variable value that is a set of folders
https://stackoverflow.com/questions/29168734
复制相似问题