I have the following method defined in my controller:
@RequestMapping(value = "/ajax/comments/post/{contentId:([apv]|ad)\\d+}") public @ResponseBody ActionResult handlePostCommentRequest(HttpServletRequest request, Model model, @PathVariable("contentId") String assetId, @RequestParam(value = "nickName", required = false, defaultValue = "Anonyymi") String nickName, @RequestParam(value = "text", required = false, defaultValue = "") String text, @RequestParam(value = "createThread", required = false, defaultValue = "false") String createThread) {
However, when I make the following HTTP request - / ajax / comments / post / ad1374659405664, I get an exception:
org.springframework.web.util.NestedServletException: Request processing failed; java.lang.IllegalArgumentException nested exception: the number of captured groups in the pattern segment (([apv] | ad) \ d +) does not match the number of URIs that it defines that can occur if capture groups are used in the regular expression of the URI pattern. Use non-capturing groups instead.
Google does not give such results, and this is strange, because when I check the regular expression ([vpa]|ad)\d+ at http://regexpal.com/ it matches everything correctly. What am I doing wrong?
source share