aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick/components
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-28 14:49:47 +0300
committerGravatar Vitaly Takmazov2016-11-28 14:49:47 +0300
commitb4225fa075eef58924399f2c5f7a117ee171c2c6 (patch)
treeb952f22ae76467da3ee8bbe79b4f9accd9a0e599 /juick-notifications/src/main/java/com/juick/components
parent5b2bd7f928bbf9d3233ff029ed5c09ac46daf0de (diff)
configure json serialization properties
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/Notifications.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java
index e0155a0a..dac4d22e 100644
--- a/juick-notifications/src/main/java/com/juick/components/Notifications.java
+++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java
@@ -17,6 +17,7 @@
*/
package com.juick.components;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.android.gcm.server.*;
import com.juick.components.mpns.MPNSError;
@@ -88,6 +89,9 @@ public class Notifications implements AutoCloseable {
xmppPort = NumberUtils.toInt(env.getProperty("xmpp_port"), 5347);
xmppPushPassword = env.getProperty("push_xmpp_password", "");
mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
}
@PostConstruct
@@ -120,6 +124,9 @@ public class Notifications implements AutoCloseable {
if (!regids.isEmpty()) {
try {
ObjectMapper messageSerializer = new ObjectMapper();
+ messageSerializer.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ messageSerializer.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ messageSerializer.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
String json = messageSerializer.writeValueAsString(jmsg);
logger.info(json);
Message message = new Message.Builder().addData("message", json).build();