简体   繁体   English

Playframework RenderXml-在响应中排除一些字段?

[英]Playframework RenderXml - exclude some fields in response?

In Playframework (1.2.4) I am looking for a function similar to GSON's @Expose annotation, where some fields may be excluded in the response (RenderXml). 在Playframework(1.2.4)中,我正在寻找类似于GSON的@Expose批注的函数,其中某些字段可能会在响应(RenderXml)中排除。 The XML response is a requirement else I would use the JSON. XML响应是一项要求,否则我将使用JSON。

Totally forgot I had asked this question. 完全忘记了我问过这个问题。 Playframework 1 uses the XML library XStream and it has annotations similar to GSON's @Expose annotation, but it is inverted. Playframework 1使用XML库XStream,并且具有与GSON的@Expose注释相似的注释,但它是反向的。 You have to exclude what you do not want to be shown in the response by using the annotation @XStreamOmitField . 您必须使用批注@XStreamOmitField排除不希望在响应中显示的@XStreamOmitField

A good tutorial can be found here . 一个很好的教程可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM