Wicketãçæããã¢ãã¬ã¹ãä»é¢¨(?)ã«ãã
Wicketãçæããã¢ãã¬ã¹ã¯æ¨æºã ã¨ãããªæãã§é常ã«è¦ãç®ããããããªãã§ãã
http://localhost:8080/app/?wicket:bookmarkablePage=page.HomePage
ãããªæã¯mountBookmarkablePage()ã使ã£ã¦ç¹å®ã®ãã¹ã«ãã¼ã¸ããããã³ã°ãããã¨ã§ãã£ãããã¾ãã
mountBookmarkablePage("/home", HomePage.class);
çæãããã¢ãã¬ã¹ã¯ãããªæãã§ãã
http://localhost:8080/app/home
ä¸è¦ããã¨ããã§è§£æ±ºãªã®ã§ãããmountBookmarkablePage()ã§ã¯ããã©ã¡ã¼ã¿ãå¿ è¦ãªå ´åã«å¾®å¦ãªåé¡ãæ®ãã¾ãããã©ã¡ã¼ã¿ãæå®ããå ´åã®ã¢ãã¬ã¹ã¯ãããªæãã§ãã
http://localhost:8080/app/home/id/user01/message/hello
æ(?)ã ã¨?id=user01&message=helloã¨ãããã®ã¾ã¾ãªæãã ã£ãã®ã§ãããã«æ¯ã¹ãã°ãã·ãªã®ã§ãããä»æã¯idã¨ããæåããªãã®ã主æµãªæ°ããã¾ããã¨ããããã§ãããWicketã§å®ç¾ããæ¹æ³ã§ãã
ä¸ã¤ã¯IndexedParamUrlCodingStrategyã使ãæ¹æ³ã§ãã使ãæ¹ã¯mountBookmarkablePage()ã®æã¨ãã¾ãå¤ããã¾ãããã代ããã«mount()ã«CodingStrategyã渡ãã¦ããã¾ããã³ã³ã¹ãã©ã¯ã¿ã«æ¸¡ãå¤ã®æå³ã¯mountBookmarkablePage()ã¨åãã§ãã
mount(new IndexedParamUrlCodingStrategy("/home", HomePage.class));
ããã§çæãããã¢ãã¬ã¹ã¯ãããªæãã§ãã
http://localhost:8080/app/home/user01/hello
ããããã®å¤ã¯ãPageParametersã®getString("0")ãgetString("1")ã¨0ããå§ã¾ãã¤ã³ããã¯ã¹ãæå®ãã¦ãããã¨ã§åå¾ã§ãã¾ãã
ããä¸ã¤ã¯MixedParamUrlCodingStrategyã使ãæ¹æ³ã§ããããã»ã©ã¨ãã¾ãå¤ããããã¾ããããï¼ã¤ç®ã®å¼æ°ã¨ãã¦ãã©ã¡ã¼ã¿ã®ãã¼å¤ãæå®ããå¿ è¦ãããã¾ãã
mount(new MixedParamUrlCodingStrategy("/home", HomePage.class, new String[] {"id"}));
ããã§çæãããã¢ãã¬ã¹ã¯ãããªæãã§ããï¼ã¤ç®ã®å¼æ°ã¨ãã¦æå®ãããã®ã ãã/ã§åºåã£ãå½¢ã«ãªãããã以å¤ã¯?以éã®ãã©ã¡ã¼ã¿ã¨ãªãã¾ãã
http://localhost:8080/app/home/user01/?message=hello
å¤ã®åå¾ã¯PageParametersã®getString("id")ãgetString("message")ã§æ®éã«è¡ããã¨ãã§ãã¾ãã
äºã¤ã®éãã¯ãIndexedParamUrlCodingStrategyã§ã¯/ã§åºåã£ããã©ã¡ã¼ã¿ã®åæ°ã«å¶éã¯ããã¾ããããMixedParamUrlCodingStrategyã§ã¯ï¼ã¤ç®ã®å¼æ°ã§æå®ããåã ããã/ã§åºåãããå½¢ã«ãªãã¾ããããã®ä»£ããã¨ãã¦ã?以éã®ãã©ã¡ã¼ã¿ãèªèããããã«ãªããããåºå®é¨åã¨å¯å¤é¨åã§æå®æ¹æ³ãå¤ãã¦å©ç¨ãããã¨ã«ãªãã¾ãã
äºã¤ã¨ãä¼¼ããããªãã¨ãå®ç¾ã§ããã®ã§ãããIndexedParamUrlCodingStrategyã ã¨ãã©ã¡ã¼ã¿åã0,1ã¨ããæå³ãåãããªããã®ã«ãªã£ã¦ãã¾ãã¾ãã®ã§ãã©ã¡ããã¨è¨ãã°MixedParamUrlCodingStrategyã®æ¹ã使ããããæ°ããã¾ãã