usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [01/10] usergrid git commit: Switch to Jersey 2, fix all compilation errors. TODO: new MeteringFilter, new JSON-HTMP swap logic and correct use of dependency management.
Date Thu, 03 Sep 2015 20:30:27 GMT
Repository: usergrid
Updated Branches:
  refs/heads/usergrid-103-upgrade-jersey [created] eb2aa6ff9


http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
index 2a5b813..096422c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
@@ -17,8 +17,6 @@
 
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
-import javax.ws.rs.core.MediaType;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
@@ -26,15 +24,14 @@ import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource.model.Organization;
 import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.apache.usergrid.rest.test.resource.model.Token;
-import org.apache.usergrid.rest.test.resource.model.User;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-import com.sun.jersey.api.representation.Form;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 import java.io.IOException;
 import java.io.StringReader;
 
@@ -62,9 +59,9 @@ public class OrgResource  extends NamedResource {
 
         // Seems like an apiresponse can't handle what gets returned from the from urlended
media type
 
-        ApiResponse response = getResource().type( MediaType.APPLICATION_FORM_URLENCODED
)
+        ApiResponse response = getTarget().request()
             .accept(MediaType.APPLICATION_JSON)
-            .post(ApiResponse.class, form);
+            .post( Entity.form( form ), ApiResponse.class);
 
         Organization organization = new Organization(response);
         organization.setOwner( response );
@@ -77,12 +74,12 @@ public class OrgResource  extends NamedResource {
     public Organization post(QueryParameters parameters){
 
         // Seems like an ApiResponse can't handle what gets returned from the from URL encoded
media type
-        WebResource resource = addParametersToResource( getResource(), parameters);
+        WebTarget resource = addParametersToResource( getTarget(), parameters);
 
         // use string type so we can log actual response from server
-        String responseString = resource.type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON)
-            .post(String.class);
+        String responseString = resource.request()
+            .accept( MediaType.APPLICATION_JSON )
+            .post( Entity.json( null ), String.class );
 
         logger.debug("Response from post: " + responseString);
 
@@ -103,9 +100,9 @@ public class OrgResource  extends NamedResource {
     public Organization post(Organization organization){
 
         // use string type so we can log actual response from server
-        String responseString = getResource(false).type( MediaType.APPLICATION_JSON_TYPE
)
-            .accept(MediaType.APPLICATION_JSON)
-            .post(String.class, organization);
+        String responseString = getTarget(false).request()
+            .accept( MediaType.APPLICATION_JSON )
+            .post( Entity.json(organization), String.class );
 
         logger.debug("Response from post: " + responseString);
 
@@ -123,8 +120,9 @@ public class OrgResource  extends NamedResource {
         return org;
     }
     public Organization post(Organization organization, Token token){
-        ApiResponse response = getResource(true,token).type( MediaType.APPLICATION_JSON_TYPE
).accept( MediaType.APPLICATION_JSON )
-                                            .post( ApiResponse.class,organization );
+        ApiResponse response = getTarget(true,token).request()
+            .accept( MediaType.APPLICATION_JSON )
+            .post( Entity.json(organization), ApiResponse.class );
 
         Organization org = new Organization(response);
         org.setOwner( response );
@@ -135,9 +133,9 @@ public class OrgResource  extends NamedResource {
     public Organization put(Organization organization){
 
         // use string type so we can log actual response from server
-        String responseString = getResource().type( MediaType.APPLICATION_JSON_TYPE )
+        String responseString = getTarget().request()
             .accept(MediaType.APPLICATION_JSON)
-            .put(String.class, organization);
+            .post( Entity.json( organization ), String.class );
 
         logger.debug("Response from put: " + responseString);
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
index cf0987e..b9bd35e 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
@@ -43,8 +43,9 @@ public class OrganizationResource extends NamedResource {
     }
 
     public Organization get() {
-        ApiResponse rep = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).get(ApiResponse.class);
+        ApiResponse rep = getTarget( true ).request()
+            .accept(MediaType.APPLICATION_JSON)
+            .get(ApiResponse.class);
 
         //TODO: not sure if this will work for multiple users.
         Organization org = new Organization(rep);
@@ -54,9 +55,9 @@ public class OrganizationResource extends NamedResource {
 
     // Doesn't return anything useful server side so this was made as a void. .
     public void put(Organization organization) {
-        Map<String, Object> response = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).put(Organization.class,
-                organization);
+        Map<String, Object> response = getTarget(true).request()
+            .accept(MediaType.APPLICATION_JSON)
+            .put( javax.ws.rs.client.Entity.json(organization), Organization.class);
 
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
index 59121ab..5779109 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
@@ -17,18 +17,10 @@
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
 
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
-import org.apache.usergrid.rest.test.resource.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource.model.Entity;
-import org.apache.usergrid.rest.test.resource.model.Token;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
-import com.sun.jersey.api.client.WebResource;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
index 3959b3e..70feb29 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
@@ -18,15 +18,14 @@
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
 
-import javax.ws.rs.core.MediaType;
-
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
 import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
-import com.sun.jersey.api.client.WebResource;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
 
 
 /**
@@ -38,9 +37,8 @@ public class ReactivateResource extends NamedResource {
     }
 
     public Entity get(){
-        WebResource resource = getResource(true);
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class);
+        WebTarget resource = getTarget(true);
+        ApiResponse response = resource.request().accept( MediaType.APPLICATION_JSON ).get(
ApiResponse.class);
         return new Entity(response);
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
index 076e284..739e2ac 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
@@ -17,13 +17,12 @@
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
 
-import javax.ws.rs.core.MediaType;
-
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
-import com.sun.jersey.api.representation.Form;
+import javax.ws.rs.core.Form;
+import javax.ws.rs.core.MediaType;
 
 
 /**
@@ -36,7 +35,8 @@ public class ResetResource extends NamedResource {
     }
 
     public String post(Form formPayload) {
-        return getResource().type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
-            .accept( MediaType.TEXT_HTML ).post( String.class, formPayload);
+        return getTarget().request()
+            .accept( MediaType.TEXT_HTML )
+            .post( javax.ws.rs.client.Entity.form(formPayload), String.class);
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
index 613955a..54fe477 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
@@ -17,13 +17,13 @@
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
 
-import com.sun.jersey.api.client.WebResource;
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
 import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.apache.usergrid.rest.test.resource.model.Token;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
+import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.MediaType;
 
 
@@ -49,10 +49,9 @@ public class TokenResource extends NamedResource {
      * @return
      */
     public Token get(QueryParameters params) {
-        WebResource resource = getResource(false);
+        WebTarget resource = getTarget( false );
         resource = addParametersToResource(resource, params);
-        Token token = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
-                              .get(Token.class);
+        Token token = resource.request().accept(MediaType.APPLICATION_JSON).get(Token.class);
 
         this.context.setToken(token);
         return token;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
index ee804e6..a25784b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
@@ -16,15 +16,15 @@
  */
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
-import javax.ws.rs.core.MediaType;
-
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
 import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
-import com.sun.jersey.api.client.WebResource;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+
 
 
 /**
@@ -71,17 +71,19 @@ public class UserResource extends NamedResource {
     }
 
     public Entity get() {
-        WebResource resource = getResource( true );
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class
);
+        WebTarget resource = getTarget( true );
+        ApiResponse response = resource.request()
+            .accept( MediaType.APPLICATION_JSON )
+            .get( ApiResponse.class );
         return new Entity(response);
     }
 
     public Entity put(Entity userPayload){
-        WebResource resource = getResource(true);
+        WebTarget resource = getTarget( true );
 
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).put( ApiResponse.class,
userPayload);
+        ApiResponse response = resource.request()
+            .accept( MediaType.APPLICATION_JSON )
+            .put( javax.ws.rs.client.Entity.json(userPayload), ApiResponse.class);
         return new Entity(response);
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
index 5ef681d..6c22469 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
@@ -18,17 +18,11 @@
 package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
 
 
-import javax.ws.rs.core.MediaType;
-
 import org.apache.usergrid.rest.test.resource.endpoints.EntityEndpoint;
 import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
-import org.apache.usergrid.rest.test.resource.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 
-import com.sun.jersey.api.client.WebResource;
-
 
 /**
  * Handles calls to the users management endpoint

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index d1ec212..466bd45 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -197,20 +197,27 @@
 
     <!-- SUN, Javax Package and Other Com Dependencies -->
 
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-core</artifactId>
-    </dependency>
+      <!-- Required only when you are using JAX-RS Client -->
+      <dependency>
+          <groupId>org.glassfish.jersey.core</groupId>
+          <artifactId>jersey-client</artifactId>
+          <version>2.21</version>
+      </dependency>
 
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-client</artifactId>
-    </dependency>
+    <!--<dependency>-->
+      <!--<groupId>com.sun.jersey</groupId>-->
+      <!--<artifactId>jersey-core</artifactId>-->
+    <!--</dependency>-->
 
-    <dependency>
-      <groupId>com.sun.jersey</groupId>
-      <artifactId>jersey-json</artifactId>
-    </dependency>
+    <!--<dependency>-->
+      <!--<groupId>com.sun.jersey</groupId>-->
+      <!--<artifactId>jersey-client</artifactId>-->
+    <!--</dependency>-->
+
+    <!--<dependency>-->
+      <!--<groupId>com.sun.jersey</groupId>-->
+      <!--<artifactId>jersey-json</artifactId>-->
+    <!--</dependency>-->
 
     <!-- Codehaus, JClouds, Spring and Other Org Dependencies -->
 
@@ -434,6 +441,7 @@
       <artifactId>stream</artifactId>
       <version>2.7.0</version>
     </dependency>
+
       <dependency>
           <groupId>com.github.fernandospr</groupId>
           <artifactId>java-wns</artifactId>
@@ -443,6 +451,17 @@
                   <artifactId>jackson-jaxrs</artifactId>
                   <groupId>org.codehaus.jackson</groupId>
               </exclusion>
+              <!-- Would be nice if we could exclude this dependency on Jersey 1.
+                   Apparently Java-WNS 1.3.1 will move to Jersey 2.
+              <exclusion>
+                  <artifactId>jersey-apache-client</artifactId>
+                  <groupId>com.sun.jersey.contribs</groupId>
+              </exclusion>
+              <exclusion>
+                  <artifactId>jersey-client</artifactId>
+                  <groupId>com.sun.jersey</groupId>
+              </exclusion>
+              -->
           </exclusions>
       </dependency>
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
index 85179e3..2ca1052 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/AbstractProvider.java
@@ -22,13 +22,11 @@ import java.util.Map;
 import com.sun.jersey.core.util.MultivaluedMapImpl;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManager;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.jackson.JacksonFeature;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.core.MultivaluedMap;
 
 
@@ -43,9 +41,9 @@ public abstract class AbstractProvider implements SignInAsProvider {
     AbstractProvider( EntityManager entityManager, ManagementService managementService )
{
         this.entityManager = entityManager;
         this.managementService = managementService;
-        ClientConfig clientConfig = new DefaultClientConfig();
-        clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE
);
-        client = Client.create( clientConfig );
+        ClientConfig clientConfig = new ClientConfig();
+        clientConfig.register( new JacksonFeature() );
+        client = ClientBuilder.newClient( clientConfig );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
index 30a497e..3931091 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/FacebookProvider.java
@@ -93,8 +93,11 @@ public class FacebookProvider extends AbstractProvider {
 
     @Override
     Map<String, Object> userFromResource( String externalToken ) {
-        return client.resource( apiUrl ).queryParam( "access_token", externalToken )
-                     .accept( MediaType.APPLICATION_JSON ).get( Map.class );
+        return client.target( apiUrl )
+            .queryParam( "access_token", externalToken )
+            .request()
+                .accept( MediaType.APPLICATION_JSON )
+                .get( Map.class );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
index d7b136e..738a20f 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
@@ -17,14 +17,8 @@
 package org.apache.usergrid.security.providers;
 
 
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.sun.jersey.api.client.WebResource;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.Query;
@@ -32,12 +26,18 @@ import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.entities.User;
 import org.apache.usergrid.security.tokens.exceptions.BadTokenException;
 import org.apache.usergrid.utils.JsonUtils;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 import static org.apache.usergrid.utils.ListUtils.anyNull;
 
@@ -85,12 +85,16 @@ public class FoursquareProvider extends AbstractProvider {
 
     @Override
     public User createOrAuthenticate( String externalToken ) throws BadTokenException {
-        ClientConfig clientConfig = new DefaultClientConfig();
-        clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE
);
-        Client client = Client.create( clientConfig );
-        WebResource web_resource = client.resource( "https://api.foursquare.com/v2/users/self"
);
-        Map<String, Object> body = web_resource.queryParam( "oauth_token", externalToken
).queryParam( "v", "20120623" )
-                                               .accept( MediaType.APPLICATION_JSON ).get(
Map.class );
+        ClientConfig clientConfig = new ClientConfig();
+        clientConfig.register( new JacksonFeature() );
+        client = ClientBuilder.newClient( clientConfig );
+
+        Map<String, Object> body = client.target( "https://api.foursquare.com/v2/users/self"
)
+            .queryParam( "oauth_token", externalToken )
+            .queryParam( "v", "20120623" )
+            .request()
+                .accept( MediaType.APPLICATION_JSON )
+                .get(Map.class);
 
         Map<String, Object> fq_user = ( Map<String, Object> ) ( ( Map<?, ?>
) body.get( "response" ) ).get( "user" );
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
b/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
index f8a66e9..939532f 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
@@ -17,22 +17,21 @@
 package org.apache.usergrid.security.providers;
 
 
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.security.tokens.exceptions.BadTokenException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import com.fasterxml.jackson.databind.JsonNode;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 
 /**
@@ -122,18 +121,17 @@ public class PingIdentityProvider extends AbstractProvider {
 
 
     @Override
-    Map<String, Object> userFromResource( String externalToken ) {
+    Map<String, Object> userFromResource(String externalToken) {
 
 
-      MultivaluedMap<String, String> formData =  getMultivaluedMapImpl();
-      formData.add("grant_type", "urn:pingidentity.com:oauth2:grant_type:validate_bearer");
-      formData.add("client_id", clientId);
-      formData.add("client_secret", clientSecret);
-      formData.add("token", externalToken);
+        MultivaluedMap<String, String> formData = getMultivaluedMapImpl();
+        formData.add( "grant_type", "urn:pingidentity.com:oauth2:grant_type:validate_bearer"
);
+        formData.add( "client_id", clientId );
+        formData.add( "client_secret", clientSecret );
+        formData.add( "token", externalToken );
 
-      JsonNode node = client.resource( apiUrl )
-          .type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
-          .post( JsonNode.class, formData );
+        JsonNode node = client.target( apiUrl ).request()
+            .post( Entity.entity( formData, MediaType.APPLICATION_FORM_URLENCODED_TYPE ),
JsonNode.class );
 
         String rawEmail = node.get( "access_token" ).get( "subject" ).asText();
 


Mime
View raw message