aboutsummaryrefslogtreecommitdiff
path: root/juick-www
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-www
parent5b2bd7f928bbf9d3233ff029ed5c09ac46daf0de (diff)
configure json serialization properties
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/java/com/juick/www/FacebookLogin.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/TwitterAuth.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/VKontakteLogin.java9
3 files changed, 16 insertions, 1 deletions
diff --git a/juick-www/src/main/java/com/juick/www/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/FacebookLogin.java
index b42bb23b..34385a3d 100644
--- a/juick-www/src/main/java/com/juick/www/FacebookLogin.java
+++ b/juick-www/src/main/java/com/juick/www/FacebookLogin.java
@@ -17,6 +17,7 @@
*/
package com.juick.www;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.server.UserQueries;
import com.juick.www.facebook.Graph;
@@ -52,6 +53,9 @@ public class FacebookLogin {
this.FACEBOOK_APPID = ApplicationID;
this.FACEBOOK_SECRET = secret;
mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
}
protected void doGet(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
diff --git a/juick-www/src/main/java/com/juick/www/TwitterAuth.java b/juick-www/src/main/java/com/juick/www/TwitterAuth.java
index c6aaf9a1..65998ece 100644
--- a/juick-www/src/main/java/com/juick/www/TwitterAuth.java
+++ b/juick-www/src/main/java/com/juick/www/TwitterAuth.java
@@ -1,5 +1,6 @@
package com.juick.www;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.scribejava.apis.TwitterApi;
import com.github.scribejava.core.builder.ServiceBuilder;
@@ -32,6 +33,9 @@ public class TwitterAuth {
this.consumerKey = consumerKey;
this.consumerSecret = consumerSecret;
mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
}
protected void doGet(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response)
diff --git a/juick-www/src/main/java/com/juick/www/VKontakteLogin.java b/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
index 83619b2a..1ccf36b6 100644
--- a/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
+++ b/juick-www/src/main/java/com/juick/www/VKontakteLogin.java
@@ -17,6 +17,7 @@
*/
package com.juick.www;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.server.UserQueries;
import com.juick.www.vk.*;
@@ -43,7 +44,13 @@ public class VKontakteLogin {
private static final String VK_SECRET = "z2afNI8jA5lIpZ2jsTm1";
private static final String VK_REDIRECT = "http://juick.com/_vklogin";
- private final ObjectMapper mapper = new ObjectMapper();
+ public VKontakteLogin() {
+ mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
+ }
+ private final ObjectMapper mapper;
protected void doGet(JdbcTemplate sql, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String code = request.getParameter("code");