aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost
diff options
context:
space:
mode:
Diffstat (limited to 'juick-crosspost')
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/Crosspost.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
index f481c348..58e3c410 100644
--- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
+++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java
@@ -60,7 +60,8 @@ public class Crosspost extends TextWebSocketHandler {
private final String twitter_consumer_key;
private final String twitter_consumer_secret;
- private ObjectMapper ms;
+ @Inject
+ private ObjectMapper jsonMapper;
@Inject
MessagesService messagesService;
@@ -72,16 +73,11 @@ public class Crosspost extends TextWebSocketHandler {
twitter_consumer_key = env.getProperty("twitter_consumer_key", StringUtils.EMPTY);
twitter_consumer_secret = env.getProperty("twitter_consumer_secret", StringUtils.EMPTY);
-
- ms = new ObjectMapper();
- ms.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
- ms.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- ms.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
- Message msg = ms.readValue(message.asBytes(), Message.class);
+ Message msg = jsonMapper.readValue(message.asBytes(), Message.class);
if (msg.getMid() > 0 && msg.getRid() == 0) {
Message jmsg = messagesService.getMessage(msg.getMid());
if (StringUtils.isNotEmpty(crosspostService.getTwitterName(msg.getUser().getUid()))) {