【问题标题】:Is there a way to modify Jersey generated XML response to include stylesheet info?有没有办法修改 Jersey 生成的 XML 响应以包含样式表信息?
【发布时间】:2012-08-31 15:39:32
【问题描述】:

在 JAXB 中,这是可能的(使用 marshaller 对象)。我不知道如何使用泽西岛。我想知道是否有办法以某种方式注入类似的东西:

<?xml-stylesheet type="text/css" href="something.css"?>

在生成的 xml 响应中。

【问题讨论】:

标签: css xml rest jersey


【解决方案1】:

参见 XmlHeader 注释。将其附加到您的资源方法。比如这样:

@GET
@Produces("application/xml")
@XmlHeader("<?xml-stylesheet type=\"text/css\" href=\"something.css\"?>")
public JaxbBean getSomeXml() {
    ....
}

【讨论】:

    猜你喜欢
    • 2014-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-01
    • 1970-01-01
    相关资源
    最近更新 更多