I have a method in my Controller which looks like this:
@RequestMapping(value = "/test", method = RequestMethod.GET)
public @ResponseBody String getNameAsXML(HttpServletRequest httpRequest, @RequestParam("name") String name)
{
... some logic goes here to get the data from the db
by name and convert it to valid xml string
...
return xmlString;
}
xmlString is a String representation of the xml I want to return.
When I run this method I can see the xml in the browser however I would like instead to give the user a download popup to allow him to download this as an xml file instead of showing it inside the browser.
I thought about returning MultipartFile instead of String but not quite sure how to do it.