aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-22 17:41:21 +0300
committerGravatar Vitaly Takmazov2017-09-22 17:41:21 +0300
commitfc19da9346f5a9e20d16d572cbc94902d7bc1c51 (patch)
treecf91cf1e3e8eae7a46164c1734dbf5326f6ffef1 /juick-crosspost/src/main/java/com/juick
parentd749fdee3a3df14e25a4864ec2cf72038c3b091d (diff)
crosspost: inject correct json mapper
Diffstat (limited to 'juick-crosspost/src/main/java/com/juick')
-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()))) {