【发布时间】:2019-03-24 03:46:35
【问题描述】:
我需要像 URL 中的参数值一样传递 ^。例如:
http://localhost:8080/myapp/books?filter=^
但有一个error:java.lang.IllegalArgumentException:在请求目标中发现无效字符。有效字符在 RFC 7230 和 RFC 3986 中定义。我读过,我需要编码。有这样的东西,但它仍然不起作用。我也尝试添加
System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow" ^ ");
但对于 ^ 没有帮助。
我有一个控制器:
@RequestMapping("/books")
public String getBooks(@RequestParam(value = "filter") String filter, Model model)
throws UnsupportedEncodingException {
String par = URLEncoder.encode(nameFilter,"UTF-8");
List<Books> books = (List<Books>) booksService.findAll(filter);
model.addAttribute("books", books);
return "getBooks";
}
}
【问题讨论】:
标签: java rest spring-mvc spring-boot url