Hi,
I have a site which supports two languages German and Japanese. The controller for the home page is like this:
The locale is controlled by request urls by checking whether they end with "-de.html" or "-jp.html". Everything works fine.Code:@Controller @RequestMapping({"/home-de.html", "/home-jp.html"}) public class HomeController { @RequestMapping(method=RequestMethod.GET) public String home(Model model) { ... } }
If the site is expanded to support more languages, the value of the RequestMapping would increase (i.e. the length of the array). My question is how to dispatch all incoming urls home-de.html, home-jp.html, home-nl.html, home-... to the same controller HomeController, where HomeController would be
I tried to use a custom HandlerMapping but failed.Code:@Controller @RequestMapping("/home.html") public class HomeController { @RequestMapping(method=RequestMethod.GET) public String home(Model model) { ... } }
Thank you!


Reply With Quote
