Spring MVC 3 RequestMapping with regular expresssion quantifiers?

I don't think there are any good workarounds for this case except for manual validation. After all {name:regexp} syntax was introduced for solving ambiguities between mappings rather than for validation.

I don't think there are any good workarounds for this case except for manual validation. After all, {name:regexp} syntax was introduced for solving ambiguities between mappings rather than for validation. @Valid on @PathVariables could be a solution, but it's promised only in Spring 3.1 (SPR-6380).

Also feel free to report this bug in Spring JIRA, although I don't expect them to fix it quickly since path variable handling code is already a mess.

Here's a solution. It's butt-ugly, but it's equivalent to what you'd like to have: @RequestMapping(value = "/{id:0-9a-z0-9a-z0-9a-z0-9a-z" + "0-9a-z0-9a-z0-9a-z0-9a-z0-9a-z0-9a-z0-9a-z" + "0-9a-z0-9a-z0-9a-z0-9a-z}") // 15 repetitions of 0-9a-z If that's the only way to get what you need, you might as well use this monster.

Wow! Shame in would have to be 32 times. 15 was just a random number for the post.

Now I have to debate if this is actually the "right" answer. – dom farr Feb 18 at 16:36 @dom well an upvote would do for starters :-) – Sean Patrick Floyd Feb 18 at 16:50 I could pull it out into a static final string with a reasonable name. I'll give you an up vote for sheer cleverness.

:) – dom farr Feb 18 at 18:50 @dom sometimes an evil hack is the only way to go :-) – Sean Patrick Floyd Feb 18 at 19:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions