had*_*uri 4 java spring spring-mvc request-mapping
我希望将所有请求与一个不以'api'开头的PathVariable匹配.我在RequestMapping之后测试.spring可以匹配请求,但无法获得PathVariable的值.我怎么解决这个问题?
@RequestMapping(value = "/{name:(?!api).+}", method = RequestMethod.GET)
public void getNotApi(@PathVariable String name, HttpServletResponse response) {
...
}
Run Code Online (Sandbox Code Playgroud)
我收到一些请求的消息如下localhost:8080/resource.
Error 500 Missing URI template variable 'name' for method parameter of type String
@RequestMapping(value = "/{name:^(?!api).+}", method = RequestMethod.GET)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2830 次 |
| 最近记录: |