I'm going to use a very basic hello world endpoint as an example
@RequestMapping("/hello")
public String hello(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
model.addAttribute("name", name);
return "helloworld";
}
If I have this endpoint and I want to be able to go to /hello and retrieve the helloworld
view.
Is it possible for me to use the SAME /hello
path to retrieve model as json if I pass in a specific request param like content-type?