[英]Spring Boot: Is it possible to consume @RequestParam's as json?
[英]Spring Boot @RequestParam truncating URL's passed in with ?'s and #'s
我在使用Spring MVC @PathValue时遇到了类似的问题,但是没有一个在线解决方案可以解决这个问题。
我目前正在开发一个应用程序,用户将输入一个URL,而@RequestParam似乎会截断传入的URL和#和s。
@RequestMapping(value = "/route/path", method = RequestMethod.GET, produces = "application/json")
public Value method(@RequestParam(value="url") String url, HttpServletRequest request) throws Exception {
//execute code
现在,例如,如果有人要传入localhost:8080 / route / path?url = https://css-tricks.com/hash-tag-links-padding/#article-header-id-0 ,查询将被截断to url = https://css-tricks.com/hash-tag-links-padding/
“&”似乎也发生了同样的事情。 我在WebMvcConfigurerAdapter中尝试了大量关于正则表达式,Bean配置和覆盖configurePathMatch的解决方案。
其他人遇到过这个问题吗? 如果是这样,你找到了解决方法吗? 谢谢!
使用encodeURIComponent对参数url
进行编码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.