aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src')
-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();