1

私は小さな Java spring プロジェクトを持っています。これは xml 応答を返す API です。応答に Cache-Control ヘッダーを追加したいのですが、方法がわかりません。応答にヘッダーを追加できますか、それともこれを 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;
}

ここに私の rest-servlet.xml ヘッダーがあります:

<?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">
4

0 に答える 0