I have a Spring MVC Controller that returns a JSON String and I would like to set the mimetype to application/json. How can I do that?
@RequestMapping(method=RequestMethod.GET, value="foo/bar")
@ResponseBody
public String fooBar(){
return myService.getJson();
}
The business objects are already available as JSON strings, so using MappingJacksonJsonView
is not the solution for me. @ResponseBody
is perfect, but how can I set the mimetype?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…