「Spring」producesでコンテンツタイプを指定する
書式
@RequestMapping(value = “/ggetUserXml", produces = MediaType.APPLICATION_XML_VALUE)
方法1
@RequestMapping(value ="/ggetUserXml", produces = "application/xml") public String ggetUserXml() { return "<user><age>21</age></user>"; }
方法2
@RequestMapping(value = "/ggetUserXml", produces = MediaType.APPLICATION_XML_VALUE) public String ggetUserXml(){ return "<user><age>21</age></user>"; }