【发布时间】:2013-10-03 20:01:49
【问题描述】:
我有一个类,其中有一个自定义反序列化器注释:
@JsonDeserialize(using = ConvertToNullDeserializer.class)
public void setObject(Integer pObj) {
this.pObj = pObj;
}
当这个对象通过 ajax 发送到云端点时,我希望触发自定义脱轨器,但我只是得到:
{
"error" : {
"message" : "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Integer from String value 'null': not a valid Integer value\n at [Source: N/A; line: -1, column: -1] (through reference chain:
"code" : 400,
"errors" : [ {
"domain" : "global",
"reason" : "badRequest",
"message" : "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Integer from String value 'null': not a valid Integer value\n at [Source: N/A; line: -1, column: -1] (through reference chain:
} ]
}
}
谢谢!
【问题讨论】:
-
我不确定我是否完全理解您的问题,云端点通常会为您处理序列化和反序列化。也许 @JsonDeserialize 注释不是您想要采用的路径,因为使用端点您将 json 相关的东西委托给系统。你的反序列化器是做什么的?
标签: java google-app-engine jquery google-cloud-endpoints