Given a Spring-MVC controller method:
@RequestMapping(value = "/method")
public void method(ParamModel params) { /*...*/ }
with model class:
public class ParamModel { public int param1; }
The following two results are as expected/desired:
- Request with
param1=1
:method
completes successfully. - Request with
param1=blah
:JBWEB000120: The request sent by the client was syntactically incorrect.
However...
- If a request is made with an additional parameter (e.g.
nonexistentparam=1
), there is no error.
Is there a way to ensure the request is validated and rejected if it includes any parameters that aren't part of this API?