![](/img/trans.png)
[英]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.