【发布时间】:2011-01-21 01:03:42
【问题描述】:
我正在执行来自客户端的以下请求:
/search/hello%2Fthere/
搜索词“hello/there”已被 URL 编码。
在服务器上,我尝试使用以下请求映射匹配此 URL:
@RequestMapping("/search/{searchTerm}/")
public Map searchWithSearchTerm(@PathVariable String searchTerm) {
// more code here
}
但是我在服务器上收到错误 404,因为我没有任何匹配的 URL。我注意到 URL 在 Spring 获取之前已被解码。因此正在尝试匹配没有任何匹配项的 /search/hello/there。
我在这里找到了与此问题相关的 Jira:http://jira.springframework.org/browse/SPR-6780。但我仍然不知道如何解决我的问题。
有什么想法吗?
谢谢
【问题讨论】:
标签: java spring spring-mvc