从REST输出json中删除“class”

时间:2016-07-20 07:42:42

标签: rest atg

ATG版本:10.2 我们几乎没有自定义类作为bean。 但是,作为回应JSON,ATG正在添加“类”如下:

"errorCode": "invalidQuery",
    "class": "abc.xyz.RestCustomErrorMap",
    "errorSpcMessage": [
      {
        "value": "2-17410520",
        "class": "abc.xyz.CustomMapType",
        "key": "campaignId"
      },
      {
        "value": "1-3TQ2",
        "class": "abc.xyz.CustomMapType",
        "key": "productId"
      },

如文档link中所述,我尝试将配置文件包含为

<?xml version="1.0" encoding="UTF-8"?>
<rest-filtering>

	<component name="abc.xyz.RestCustomErrorMap" default-include="true">
		<property name="class" hidden="true" />
	</component>
	
	<component name="abc.xyz.CustomMapType" default-include="true">
		<property name="class" hidden="true" />
	</component>
	
</rest-filtering>

但仍然无法从响应json !!

过滤掉“class”属性

1 个答案:

答案 0 :(得分:1)

试试这个:

<component name="abc.xyz.RestCustomErrorMap" default-filter="summary">
    <filter id="summary" default-include="false">
        <property name="class" hidden="true" />
    </filter>
</component>