我希望能夠通過java.util.Date
到CORDA API端點在模型如何白名單類型的序列化與CORDA
示範
public final class Message{
public Date birthday;
public Message(Date birthday) {
this.birthday = birthday;
}
private Message() {
// This is only here so the serializer can spin up a new instance.
}
public Date getBirthday() {
return birthday;
}
}
的API
@Path("foo")
public final class FooApi {
@PUT
@Path("bar")
@Produces(MediaType.APPLICATION_JSON)
public Response putBar(Message m) {
// Some logic here
return Response.ok("Successful").build();
}
}
問題是,當我提交一個Date
,我得到這個:
Classjava.util.Dateisnotannotatedoronthewhitelist, socannotbeusedinserializationSerializationtrace: closeDate(com.template.messages.Message)
如何白名單Date
序列化?
羅傑,你還介意添加Corda V1的答案嗎? – series0ne
當然,我會編輯上面的帖子。 –