I have a little java spring project, it is an API that returns xml response. Want to add Cache-Control header to response but im not able to find out how. Can I add headers to response or I have to move this to MVC?
@RequestMapping(method=RequestMethod.GET,value="/search/discountsall",
produces="application/xml")
public ModelAndView searchAll() {
SearchDiscounts discounts = new SearchDiscounts();
discounts = serviceFacade.getAll();
ModelAndView mav = new ModelAndView("xmlView");
mav.addObject("discounts", discounts);
return mav;
}
Here is my rest-servlet.xml header:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">