syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matte...@apache.org
Subject syncope git commit: [SYNCOPE-994] add encoding and content of wicket resources responses
Date Fri, 20 Jan 2017 11:22:34 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X d1eb8dcf4 -> 314f8364b


[SYNCOPE-994] add encoding and content of wicket resources responses


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/314f8364
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/314f8364
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/314f8364

Branch: refs/heads/2_0_X
Commit: 314f8364be9972a11e51d18c6efdcdf4b9091dc1
Parents: d1eb8dc
Author: Matteo Di Carlo <matteo.dicarlo@tirasa.net>
Authored: Fri Jan 20 12:21:09 2017 +0100
Committer: Matteo Di Carlo <matteo.dicarlo@tirasa.net>
Committed: Fri Jan 20 12:21:09 2017 +0100

----------------------------------------------------------------------
 .../console/resources/FilesystemResource.java      |  2 ++
 .../console/resources/WorkflowDefGETResource.java  |  3 ++-
 .../enduser/resources/AnyTypeClassResource.java    |  2 ++
 .../client/enduser/resources/AnyTypeResource.java  |  3 +++
 .../resources/ExternalResourceResource.java        |  2 ++
 .../client/enduser/resources/GroupResource.java    |  2 +-
 .../client/enduser/resources/InfoResource.java     |  3 +++
 .../client/enduser/resources/LoginResource.java    |  3 ++-
 .../client/enduser/resources/RealmResource.java    |  3 +++
 .../client/enduser/resources/SchemaResource.java   |  3 +++
 .../resources/SecurityQuestionResource.java        |  5 ++++-
 .../enduser/resources/UserSelfChangePassword.java  |  3 +++
 .../resources/UserSelfConfirmPasswordReset.java    |  2 ++
 .../enduser/resources/UserSelfCreateResource.java  | 15 +++++++++------
 .../enduser/resources/UserSelfPasswordReset.java   |  3 +++
 .../enduser/resources/UserSelfReadResource.java    |  5 +++++
 .../enduser/resources/UserSelfUpdateResource.java  | 17 ++++++++++-------
 17 files changed, 59 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/console/src/main/java/org/apache/syncope/client/console/resources/FilesystemResource.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/resources/FilesystemResource.java
b/client/console/src/main/java/org/apache/syncope/client/console/resources/FilesystemResource.java
index e976b16..4259ff7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/resources/FilesystemResource.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/resources/FilesystemResource.java
@@ -21,6 +21,7 @@ package org.apache.syncope.client.console.resources;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.util.io.IOUtils;
 import org.slf4j.Logger;
@@ -55,6 +56,7 @@ public class FilesystemResource extends AbstractResource {
                     replace('/', File.separatorChar);
             LOG.debug("Request for {}", subPath);
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java
b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java
index 91e2548..24a5d15 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/resources/WorkflowDefGETResource.java
@@ -21,6 +21,7 @@ package org.apache.syncope.client.console.resources;
 import java.io.IOException;
 import javax.ws.rs.core.MediaType;
 import org.apache.syncope.client.console.rest.WorkflowRestClient;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.util.io.IOUtils;
 
@@ -38,7 +39,7 @@ public class WorkflowDefGETResource extends AbstractResource {
         ResourceResponse response = new ResourceResponse();
         response.disableCaching();
         response.setContentType(MediaType.APPLICATION_JSON);
-
+        response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
         response.setWriteCallback(new WriteCallback() {
 
             @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
index 6d230c1..b1a3cc3 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeClassResource.java
@@ -23,6 +23,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
 import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
 import org.apache.wicket.request.resource.AbstractResource;
@@ -55,6 +56,7 @@ public class AnyTypeClassResource extends AbstractBaseResource {
 
             final List<AnyTypeClassTO> anyTypeClassTOs = anyTypeClassService.list();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
index 5d58f37..251cd55 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/AnyTypeResource.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
 import org.apache.syncope.common.rest.api.service.AnyTypeService;
 import org.apache.wicket.request.resource.AbstractResource;
@@ -55,6 +56,8 @@ public class AnyTypeResource extends AbstractBaseResource {
             String kind = attributes.getParameters().get(0).toString();
             final AnyTypeTO anyTypeTO = anyTypeService.read(kind);
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
index e779a94..b0602c4 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/ExternalResourceResource.java
@@ -23,6 +23,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.rest.api.service.ResourceService;
 import org.apache.wicket.request.resource.AbstractResource;
@@ -56,6 +57,7 @@ public class ExternalResourceResource extends AbstractBaseResource {
 
             final List<ResourceTO> resourceTOs = resourceService.list();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
index 0099859..150fa96 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/GroupResource.java
@@ -59,7 +59,7 @@ public class GroupResource extends AbstractBaseResource {
             final List<GroupTO> groupTOs = groupService.search(new AnyQuery.Builder().realm(realm).
                     fiql(SyncopeClient.getGroupSearchConditionBuilder().isAssignable().query()).
                     build()).getResult();
-
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
index a47f81c..4a21ed8 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/InfoResource.java
@@ -19,12 +19,14 @@
 package org.apache.syncope.client.enduser.resources;
 
 import java.io.IOException;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.adapters.PlatformInfoAdapter;
 import org.apache.syncope.client.enduser.util.SaltGenerator;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.util.cookies.CookieUtils;
 import org.slf4j.Logger;
@@ -51,6 +53,7 @@ public class InfoResource extends AbstractBaseResource {
                 sessionCookieUtils.save(SyncopeEnduserConstants.XSRF_COOKIE, SaltGenerator.generate(
                         SyncopeEnduserSession.get().getId()));
             }
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
index bc8a08c..a8483cc 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/LoginResource.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
 import org.apache.syncope.client.enduser.model.Credentials;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.util.io.IOUtils;
@@ -60,8 +61,8 @@ public class LoginResource extends AbstractBaseResource {
             } else if (!SyncopeEnduserApplication.get().getAdminUser().equalsIgnoreCase(username)
                     && SyncopeEnduserSession.get().authenticate(username, password))
{
                 // user has been authenticated successfully
+                response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
                 response.setWriteCallback(new WriteCallback() {
-
                     @Override
                     public void writeData(final Attributes attributes) throws IOException
{
                         attributes.getResponse().write(username);

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/RealmResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/RealmResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/RealmResource.java
index 6d5049b..c87b653 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/RealmResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/RealmResource.java
@@ -23,6 +23,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.rest.api.service.RealmService;
 import org.apache.wicket.request.resource.AbstractResource;
@@ -53,6 +54,8 @@ public class RealmResource extends AbstractBaseResource {
 
             final List<RealmTO> realmTOs = realmService.list();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
index e60a0a7..d8c0d9d 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SchemaResource.java
@@ -29,6 +29,7 @@ import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.model.SchemaResponse;
 import org.apache.syncope.common.lib.EntityTOUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
 import org.apache.syncope.common.lib.to.GroupTO;
@@ -137,6 +138,8 @@ public class SchemaResource extends AbstractBaseResource {
                     ComparatorUtils.<String>naturalComparator(),
                     EntityTOUtils.keyTransformer()));
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
             response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
index 0893c22..160c30e 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/SecurityQuestionResource.java
@@ -21,8 +21,10 @@ package org.apache.syncope.client.enduser.resources;
 import java.io.IOException;
 import java.util.List;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.SecurityQuestionTO;
 import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -66,7 +68,8 @@ public class SecurityQuestionResource extends AbstractBaseResource {
             //if the username is defined then retrieve its security questions, otherwise
retrieve all security questions
             if (!username.isEmpty()) {
                 final SecurityQuestionTO securityQuestionTO = securityQuestionService.readByUser(username.toString());
-
+                response.setContentType(MediaType.APPLICATION_JSON);
+                response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
                 response.setWriteCallback(new AbstractResource.WriteCallback() {
 
                     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
index e827618..90ffdcd 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfChangePassword.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
@@ -63,6 +64,8 @@ public class UserSelfChangePassword extends AbstractBaseResource {
 
             final String responseMessage = new StringBuilder().append("Password changed correctly").toString();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
index 801aeda..c7a3a55 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfConfirmPasswordReset.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
@@ -69,6 +70,7 @@ public class UserSelfConfirmPasswordReset extends AbstractBaseResource {
 
             final String responseMessage = new StringBuilder().append("Password changed correctly").toString();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
index eddd439..fd65e93 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -32,6 +32,7 @@ import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
@@ -180,6 +181,8 @@ public class UserSelfCreateResource extends AbstractBaseResource {
                 // adapt request and create user
                 final Response res = userSelfService.create(userTO, true);
 
+                response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
                 response.setWriteCallback(new WriteCallback() {
 
                     @Override
@@ -187,9 +190,9 @@ public class UserSelfCreateResource extends AbstractBaseResource {
                         attributes.getResponse().write(res.getStatusInfo().getFamily().equals(
                                 Response.Status.Family.SUCCESSFUL)
                                         ? responseMessage.append("User: ").append(userTO.getUsername()).append(
-                                                " successfully created")
+                                        " successfully created")
                                         : new StringBuilder().append("ErrorMessage{{ ").
-                                                append(res.getStatusInfo().getReasonPhrase()).append("
}}"));
+                                        append(res.getStatusInfo().getReasonPhrase()).append("
}}"));
                     }
                 });
                 response.setStatusCode(res.getStatus());
@@ -204,10 +207,10 @@ public class UserSelfCreateResource extends AbstractBaseResource {
             LOG.error("Could not create userTO", e);
             response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                     new StringBuilder().
-                            append("ErrorMessage{{ ").
-                            append(e.getMessage()).
-                            append(" }}").
-                            toString());
+                    append("ErrorMessage{{ ").
+                    append(e.getMessage()).
+                    append(" }}").
+                    toString());
         }
         return response;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
index 84e1bba..31c1fc8 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfPasswordReset.java
@@ -21,9 +21,11 @@ package org.apache.syncope.client.enduser.resources;
 import java.io.IOException;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
@@ -81,6 +83,7 @@ public class UserSelfPasswordReset extends AbstractBaseResource {
             final String responseMessage = new StringBuilder().append("Password reset request
sent for user ").append(
                     username).toString();
 
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index a792f00..a0342b1 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -23,10 +23,12 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
@@ -92,6 +94,9 @@ public class UserSelfReadResource extends AbstractBaseResource {
             }
 
             final String selfTOJson = MAPPER.writeValueAsString(userTO);
+            response.setContentType(MediaType.APPLICATION_JSON);
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
+
             response.setWriteCallback(new WriteCallback() {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/314f8364/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
index dbc6bef..e144ead 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
@@ -32,6 +32,7 @@ import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
@@ -166,10 +167,12 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
 
             final String responseMessage = res.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)
                     ? new StringBuilder().
-                            append("User").append(userTO.getUsername()).append(" successfully
updated").toString()
+                    append("User").append(userTO.getUsername()).append(" successfully updated").toString()
                     : new StringBuilder().
-                            append("ErrorMessage{{ ").append(res.getStatusInfo().getReasonPhrase()).append("
}}").
-                            toString();
+                    append("ErrorMessage{{ ").append(res.getStatusInfo().getReasonPhrase()).append("
}}").
+                    toString();
+
+            response.setTextEncoding(SyncopeConstants.DEFAULT_ENCODING);
             response.setWriteCallback(new WriteCallback() {
 
                 @Override
@@ -184,10 +187,10 @@ public class UserSelfUpdateResource extends AbstractBaseResource {
             LOG.error("Error while updating user", e);
             response.setError(Response.Status.BAD_REQUEST.getStatusCode(),
                     new StringBuilder().
-                            append("ErrorMessage{{ ").
-                            append(e.getMessage()).
-                            append(" }}").
-                            toString());
+                    append("ErrorMessage{{ ").
+                    append(e.getMessage()).
+                    append(" }}").
+                    toString());
         }
         return response;
     }


Mime
View raw message