我有一个在 Tomcat 上运行的 Spring-Boot 应用程序。在其中,我有一个带有路径变量的 RestController 。 默认情况下,路径变量会被解码,例如如果我给出 http://localhost:8080/v1/test/test2/%26 ,路径变量自动解码为 & ,我需要禁用此自动解码。
@RequestMapping(value = "/v1/test/test2//{pathVariable:.+}", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public String getV2LocationByName(
@PathVariable
String cityName,
@RequestParam(value = LANGUAGE, defaultValue = US_ENGLISH_LOCALE) String language,
HttpServletRequest request) throws InterruptedException, ExecutionException {
--------------
---------------
}
最佳答案
关于java - 如何在Spring Boot中默认阻止@PathVariable值的解码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55613904/