Announcement Announcement Module
No announcement yet.
Force response content-type Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Force response content-type


    I'm generating svg charts dynamically and returning it from my controller. This is working perfectly except that it's not returning the correct ""image/svg+xml"" Content-Type in the header which is making some padding problems in the browser. I've tried to force it with setContentType or addheader but it's still returning "text/html".

    I've allready read about the "Accept" header thing but I really want to be able to force it manually.

    Here is the controller method that returns the svg :

    @RequestMapping(value = "/company/{isin}/history", method = RequestMethod.GET)
    public String getHistoryChart(Model model, @PathVariable String isin, HttpServletResponse response) {
    	String svg = companyModel.getHistoryChart(isin, new Dimension(700, 200));
    	response.addHeader("Content-Type", "image/svg+xml");
    	return svg;
    Thank you so much if someone could help me ... this is driving me crazy