Springboot用@PathVariable传参,最后一个参数会丢失小数点后面的部分
{objectName:.+}
如参数名为沁园春.docx
编码后为/%e6%b2%81%e5%9b%ad%e6%98%a5.docx
eg:
/%e6%b2%81%e5%9b%ad%e6%98%a5.docx
@ResponseBody
@RequestMapping(value = "bos/url/{objectName:.+}", method = RequestMethod.GET)
public ResultResponse getUrl(@PathVariable String objectName) throws UnsupportedEncodingException {
... ...
}
如果为bos/url/{objectName}会丢失小数点后的后缀,改为{objectName:.+}既可以不丢失
网友评论