Is there a way to modify Jersey generated XML response to include stylesheet info?

后端 未结 1 1778
攒了一身酷
攒了一身酷 2021-01-23 08:03

In JAXB, it\'s possible (using the marshaller object). I don\'t know how to do it using Jersey. I was wondering if there\'s a way I can somehow inject something like:

相关标签:
1条回答
  • 2021-01-23 08:42

    See XmlHeader annotation. Attach that to your resource method. For example like this:

    @GET
    @Produces("application/xml")
    @XmlHeader("<?xml-stylesheet type=\"text/css\" href=\"something.css\"?>")
    public JaxbBean getSomeXml() {
        ....
    }
    
    0 讨论(0)
提交回复
热议问题