Hi,

I am using Spring 3.1 for REST controller & trying to validate integer in request param.

Code:
@Controller
public class MyController {

    @RequestMapping(value = "/v1/mymapping", method = RequestMethod.GET, produces = { "application/json",
            "application/xml" })
    @ResponseBody
    public List<MyObject> getResponse(@RequestHeader("Accept") final String acceptHeader,
            @RequestParam(value = "count", required = false, defaultValue="20") final Integer count
     ) throws Exception {
..............
..............
..............
     }
I tried following options:
  1. using oval validation
    Code:
    @RequestParam(value = "count", required = false, defaultValue="20") @NotNegative final int count
  2. Using regex
    Code:
    @RequestParam(value = "count:[1-9][0-9]", required = false, defaultValue="20") final int count



None of the above options are working. Is there any way in spring to validate request param of type integer?