long と String の 2 つのパラメーターを持つ Spring コントローラーがあります。
@RequestMapping(value = "/webpage")
@Controller
public class WebpageContentController {
//...
@RequestMapping(value = "{webpageId}/{webpageAddress}", method = RequestMethod.GET)
public String contentWebpageById(@PathVariable long webpageId, @PathVariable String webpageAddress) {
System.out.println("webpageId=" + webpageId);
System.out.println("webpageAddress=" + webpageAddress);
//...
}
//...
次のように呼び出すと:
http://localhost:8080/webarch/webpage/1/blahblah
すべて良好:
webpageId=1
webpageAddress=blahblah
しかし、スラッシュ付きの文字列パラメーターを渡すと (この場合は URL アドレス):
http://localhost:8080/webarch/webpage/1/https://en.wikipedia.org/wiki/Main_Page
エラーが発生します:
org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/webarch/webpage/1/https://en.wikipedia.org/wiki/Main_Page] in DispatcherServlet with name 'appServlet'
そのようなパラメータをどのように渡しますか?