syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [57/57] syncope git commit: [SYNCOPE-119] Better integration with changes from SYNCOPE-654
Date Tue, 21 Apr 2015 09:34:26 GMT
[SYNCOPE-119] Better integration with changes from SYNCOPE-654


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

Branch: refs/heads/master
Commit: eb9ea2a279000f8c52780404e410efc888078dee
Parents: 4115c57
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Apr 21 11:29:57 2015 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Apr 21 11:29:57 2015 +0200

----------------------------------------------------------------------
 .../apache/syncope/client/lib/RestClientFactoryBean.java    | 4 +++-
 .../java/org/apache/syncope/client/lib/SyncopeClient.java   | 9 +++++++--
 .../main/java/org/apache/syncope/core/logic/UserLogic.java  | 2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
index f7a00df..754a745 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientFactoryBean.java
@@ -28,6 +28,8 @@ import org.apache.cxf.jaxrs.client.WebClient;
  */
 public class RestClientFactoryBean extends JAXRSClientFactoryBean {
 
+    public static final String HEADER_SPLIT_PROPERTY = "org.apache.cxf.http.header.split";
+
     /**
      * Creates an anonymous instance of the given service class, for the given content type.
      *
@@ -63,7 +65,7 @@ public class RestClientFactoryBean extends JAXRSClientFactoryBean {
         final T serviceInstance = create(serviceClass);
         WebClient.client(serviceInstance).type(mediaType).accept(mediaType);
         WebClient.getConfig(WebClient.client(serviceInstance)).
-                getRequestContext().put("org.apache.cxf.http.header.split", true);
+                getRequestContext().put(HEADER_SPLIT_PROPERTY, true);
         return serviceInstance;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index c921272..4949740 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -110,7 +110,12 @@ public class SyncopeClient {
 
     @SuppressWarnings("unchecked")
     public Pair<Map<Entitlement, Set<String>>, UserTO> self() {
-        Response response = getService(UserSelfService.class).read();
+        // Explicitly disable header value split because it interferes with JSON deserialization
below
+        UserSelfService serviceInstance = getService(UserSelfService.class);
+        WebClient.getConfig(WebClient.client(serviceInstance)).
+                getRequestContext().put(RestClientFactoryBean.HEADER_SPLIT_PROPERTY, false);
+
+        Response response = serviceInstance.read();
         if (response.getStatusInfo().getStatusCode() != Response.Status.OK.getStatusCode())
{
             Exception ex = exceptionMapper.fromResponse(response);
             if (ex != null) {
@@ -121,7 +126,7 @@ public class SyncopeClient {
         try {
             return new ImmutablePair<>(
                     (Map<Entitlement, Set<String>>) new ObjectMapper().readValue(
-                            response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS).replaceAll("%2C",
","),
+                            response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS),
                             new TypeReference<HashMap<Entitlement, Set<String>>>()
{
                             }),
                     response.readEntity(UserTO.class));

http://git-wip-us.apache.org/repos/asf/syncope/blob/eb9ea2a2/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 10a3650..4929d62 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -140,7 +140,7 @@ public class UserLogic extends AbstractSubjectLogic<UserTO, UserMod>
{
     @Transactional(readOnly = true)
     public Pair<String, UserTO> readSelf() {
         return ImmutablePair.of(
-                POJOHelper.serialize(AuthContextUtils.getAuthorizations()).replaceAll(",",
"%2C"),
+                POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
                 binder.getAuthenticatedUserTO());
     }
 


Mime
View raw message