diff options
author | 2017-03-29 12:52:41 +0300 | |
---|---|---|
committer | 2017-03-29 12:52:41 +0300 | |
commit | b8651556c21c83448e46b270ed7013f490e53a5d (patch) | |
tree | 67c77b763ccc9ff21c6760e9957789ea65f1f00b /juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java | |
parent | bb7b8ef32d3c5b0a421ec641564ade7ab6b09c31 (diff) |
juick-www: inject json mapper
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java index b1d275b6..178f6762 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java @@ -17,7 +17,6 @@ */ package com.juick.www.controllers; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.scribejava.apis.FacebookApi; import com.github.scribejava.core.builder.ServiceBuilder; @@ -61,7 +60,8 @@ public class FacebookLogin { private final String FACEBOOK_APPID; private final String FACEBOOK_SECRET; private final String FACEBOOK_REDIRECT = "http://juick.com/_fblogin"; - private final ObjectMapper mapper; + @Inject + private ObjectMapper jsonMapper; private ServiceBuilder serviceBuilder; @Inject @@ -74,10 +74,6 @@ public class FacebookLogin { FACEBOOK_APPID = env.getProperty("facebook_appid"); FACEBOOK_SECRET = env.getProperty("facebook_secret"); serviceBuilder = new ServiceBuilder(); - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); } @RequestMapping(value = "/_fblogin", method = RequestMethod.GET) @@ -122,7 +118,7 @@ public class FacebookLogin { logger.error("FACEBOOK GRAPH ERROR"); throw new HttpBadRequestException(); } - User fb = mapper.readValue(graph, User.class); + User fb = jsonMapper.readValue(graph, User.class); long fbID = NumberUtils.toLong(fb.getId(), 0); if (fbID == 0 || StringUtils.isBlank(fb.getName()) || StringUtils.isBlank(fb.getLink())) { throw new HttpBadRequestException(); |