在我的应用程序中,我通过将图像ID传递给REST api来删除图像。
DELETE http://localhost:8080/connect/images/123456/abcdef
所以,我用spring MVC将其映射如下
@ResponseBody
@RequestMapping(value="/images/{imageId}", method=RequestMethod.DELETE,
produces=MediaType.APPLICATION_JSON_VALUE)
public ResponseObject deleteImage(final HttpServletResponse response, HttpServletRequest request, @PathVariable("imageId") final String imageId) {
return ResponseUtil.executeInTryCatch(new ResponseCallback() {
@Override
public Object execute() throws Throwable {
deleteImage(imageId);
return "Image deleted successfully";
}
});
}
但是我无法在图像之后将其余的URI提取到imageId路径变量。
我希望 imageId 应为123456/abcdef
。有没有办法使用@PathVariable
正则表达式支持提取?