@RequestMapping("/news/{year}/{month}/{day}/{title}") public ModelAndView news(HttpServletRequest request, HttpServletResponse response, @PathVariable int year, @PathVariable int month, @PathVariable int day, @PathVariable String title) { SessionBL sessionManager = new SessionBL(request, response); String postUrl = String.format("/%d/%d/%d/%s", year, month, day, title); ModelAndView modelAndView = new ModelAndView("index"); modelAndView.addObject("version", new Statics().getVersion()); return modelAndView; }
References
http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-uri-templates-regex
https://www.mkyong.com/spring-mvc/spring-rest-requestmapping-extract-incorrectly-if-value-contains/