Is is possible to delegate different @RequestMapping
methods by evaluation get-query parameter?
Example: if I call localhost:8080/cars?format=csv
I want to invoke the first method.
But if I call localhost:8080/cars?format=anyothervalue
I'd like to invoke the second method. Is that possible in spring using @RequestParam
s?
@RestController
public class MyServlet {
@RequestMapping("/cars", {format == 'csv'})
public Response doGetCsv(@RequestParam format) {
}
@RequestMapping("/cars", {format == 'xml'})
public Response doGetOthers(@RequestParam format) {
}
}