我在控制器操作上使用通配符映射,并希望通过通配符获得字符串匹配.我怎么能以正确的方式做到这一点?不使用子串等
@Controller
@RequestMapping(value = "/properties")
public class PropertiesController {
@RequestMapping(value = "/**", method=RequestMethod.GET)
public void getFoo() {
String key = (String) request. getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
// returns "/properties/foo/bar" ...
// I want only "foo/bar" part
// ...
}
}|
Run Code Online (Sandbox Code Playgroud) spring-mvc ×1