I have a class that models my request, something like
class Venue {
private String city;
private String place;
// Respective getters and setters
As per the Spring documentation available at http://static.springsource.org/spring/docs/3.2.3.RELEASE/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-uri-templates, automatic support is provided to simple types only:
A @PathVariable argument can be of any simple type such as int, long, Date, etc. Spring automatically converts to the appropriate type or throws a TypeMismatchException if it fails to do so.
I haven't tried this specific combination of @RequestParam
and Model
, but it looks like you can achieve your desired implementation by creating a custom WebBindingInitializer
, as detailed at http://static.springsource.org/spring/docs/3.2.3.RELEASE/spring-framework-reference/html/mvc.html#mvc-ann-typeconversion.
The custom class will have access to the WebRequest and would return a domain object populated with data extracted from this request.