usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [07/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:33 GMT
Switch to Jersey 2, fix all compilation errors. TODO: new MeteringFilter, new JSON-HTMP swap logic and correct use of dependency management.


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

Branch: refs/heads/usergrid-103-upgrade-jersey
Commit: 0578d987abc9eacb41af50f8957e90d16f6f7025
Parents: 2303eea
Author: Dave Johnson <snoopdave@apache.org>
Authored: Fri Aug 28 10:57:13 2015 -0400
Committer: Dave Johnson <snoopdave@apache.org>
Committed: Fri Aug 28 10:57:13 2015 -0400

----------------------------------------------------------------------
 stack/pom.xml                                   | 248 ++++----
 stack/rest/pom.xml                              |  91 ++-
 .../usergrid/rest/AbstractContextResource.java  |  45 +-
 .../org/apache/usergrid/rest/IndexResource.java |  54 +-
 .../apache/usergrid/rest/MigrateResource.java   |  61 +-
 .../org/apache/usergrid/rest/RootResource.java  |  92 ++-
 .../apache/usergrid/rest/SystemResource.java    |  45 +-
 .../usergrid/rest/TextToJsonSwapWriter.java     | 180 +++---
 .../rest/applications/ApplicationResource.java  |  31 +-
 .../rest/applications/ServiceResource.java      | 109 ++--
 .../applications/assets/AssetsResource.java     |  13 +-
 .../applications/events/EventsResource.java     |  36 +-
 .../notifiers/NotifierResource.java             |  29 +-
 .../notifiers/NotifiersResource.java            |  29 +-
 .../rest/applications/queues/QueueResource.java |  86 ++-
 .../queues/QueueSubscriberResource.java         |  63 +-
 .../queues/QueueSubscriptionResource.java       |  63 +-
 .../queues/QueueTransactionsResource.java       |  40 +-
 .../rest/applications/users/UserResource.java   | 134 ++--
 .../rest/applications/users/UsersResource.java  |  51 +-
 .../exceptions/NotFoundExceptionMapper.java     |   3 +-
 .../rest/exceptions/SecurityException.java      |  31 +-
 .../rest/filters/JSONPCallbackFilter.java       |  22 +-
 .../usergrid/rest/filters/MeteringFilter.java   | 632 ++++++++++---------
 .../usergrid/rest/filters/TracingFilter.java    |  37 +-
 .../rest/management/ManagementResource.java     |  51 +-
 .../management/metrics/MetricsResource.java     |   9 +-
 .../organizations/OrganizationResource.java     |  50 +-
 .../organizations/OrganizationsResource.java    |  56 +-
 .../applications/ApplicationResource.java       |  50 +-
 .../applications/ApplicationsResource.java      |  48 +-
 .../imports/FileErrorsResource.java             |  41 +-
 .../imports/FileIncludesResource.java           |  15 +-
 .../applications/imports/ImportsResource.java   |  57 +-
 .../organizations/users/UsersResource.java      |  88 +--
 .../rest/management/users/UserResource.java     |  95 +--
 .../rest/management/users/UsersResource.java    |  11 +-
 .../organizations/OrganizationsResource.java    |  76 +--
 .../organizations/OrganizationResource.java     |  28 +-
 .../rest/security/CrossOriginRequestFilter.java |  16 +-
 .../security/SecuredResourceFilterFactory.java  |  99 ++-
 .../shiro/filters/BasicAuthSecurityFilter.java  |  24 +-
 .../ClientCredentialsSecurityFilter.java        |  17 +-
 .../OAuth2AccessTokenSecurityFilter.java        | 143 ++---
 .../security/shiro/filters/SecurityFilter.java  |  11 +-
 .../apache/usergrid/rest/utils/CORSUtils.java   |  42 +-
 .../java/org/apache/usergrid/rest/BasicIT.java  |  23 +-
 .../apache/usergrid/rest/IndexResourceIT.java   |  39 +-
 .../apache/usergrid/rest/PartialUpdateTest.java |  10 +-
 .../apache/usergrid/rest/SystemResourceIT.java  |   7 +-
 .../org/apache/usergrid/rest/TomcatRuntime.java |  12 +-
 .../rest/applications/ApplicationCreateIT.java  |  14 +-
 .../rest/applications/ApplicationDeleteIT.java  | 153 ++---
 .../applications/ApplicationResourceIT.java     | 253 ++++----
 .../applications/assets/AssetResourceIT.java    |   9 +-
 .../applications/assets/AwsAssetResourceIT.java |  53 +-
 .../applications/assets/aws/NoAWSCredsRule.java |  15 +-
 .../collection/CollectionsResourceIT.java       |  26 +-
 .../collection/DuplicateNameIT.java             |   5 +-
 .../activities/ActivityResourceIT.java          |   5 +-
 .../collection/devices/DevicesResourceIT.java   |   4 +-
 .../collection/groups/GroupResourceIT.java      |  28 +-
 .../users/ConnectionResourceTest.java           |   8 +-
 .../collection/users/OwnershipResourceIT.java   |  15 +-
 .../collection/users/PermissionsResourceIT.java |  34 +-
 .../collection/users/UserResourceIT.java        | 126 ++--
 .../queries/BadGrammarQueryTest.java            |  15 +-
 .../applications/queries/BasicGeoTests.java     |  45 +-
 .../rest/filters/ContentTypeResourceIT.java     |  43 +-
 .../usergrid/rest/management/AccessTokenIT.java |  42 +-
 .../usergrid/rest/management/AdminUsersIT.java  |  31 +-
 .../rest/management/ExportResourceIT.java       | 137 ++--
 .../rest/management/ImportResourceIT.java       |  50 +-
 .../rest/management/ManagementResourceIT.java   |  88 +--
 .../rest/management/OrganizationsIT.java        |  32 +-
 .../rest/management/RegistrationIT.java         |  32 +-
 .../organizations/AdminEmailEncodingIT.java     |   5 +-
 .../rest/test/resource/AbstractRestIT.java      |  43 +-
 .../usergrid/rest/test/resource/RestClient.java |  41 +-
 .../test/resource/TestPropertiesResource.java   |  14 +-
 .../endpoints/ApplicationsResource.java         |   8 +-
 .../resource/endpoints/CollectionEndpoint.java  |  88 +--
 .../test/resource/endpoints/EntityEndpoint.java |  40 +-
 .../test/resource/endpoints/NamedResource.java  | 128 ++--
 .../test/resource/endpoints/RootResource.java   |   4 +-
 .../test/resource/endpoints/SetupResource.java  |  22 +-
 .../test/resource/endpoints/SystemResource.java |  11 +-
 .../test/resource/endpoints/TokenResource.java  |  15 +-
 .../test/resource/endpoints/UrlResource.java    |   7 +-
 .../endpoints/mgmt/ApplicationResource.java     |  27 +-
 .../endpoints/mgmt/ApplicationsResource.java    |   4 +-
 .../endpoints/mgmt/AuthorizeResource.java       |   7 +-
 .../endpoints/mgmt/ConfirmResource.java         |  12 +-
 .../endpoints/mgmt/CredentialsResource.java     |   7 +-
 .../resource/endpoints/mgmt/FeedResource.java   |   5 +-
 .../resource/endpoints/mgmt/OrgResource.java    |  38 +-
 .../endpoints/mgmt/OrganizationResource.java    |  11 +-
 .../endpoints/mgmt/PasswordResource.java        |   8 -
 .../endpoints/mgmt/ReactivateResource.java      |  10 +-
 .../resource/endpoints/mgmt/ResetResource.java  |  10 +-
 .../resource/endpoints/mgmt/TokenResource.java  |   7 +-
 .../resource/endpoints/mgmt/UserResource.java   |  20 +-
 .../resource/endpoints/mgmt/UsersResource.java  |   6 -
 stack/services/pom.xml                          |  43 +-
 .../security/providers/AbstractProvider.java    |  16 +-
 .../security/providers/FacebookProvider.java    |   7 +-
 .../security/providers/FoursquareProvider.java  |  42 +-
 .../providers/PingIdentityProvider.java         |  38 +-
 108 files changed, 2655 insertions(+), 2695 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 16783b2..dc42920 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -107,11 +107,11 @@
       <jackson-version>1.9.9</jackson-version>
       <jackson-2-version>2.3.3</jackson-2-version>
       <jclouds.version>1.9.0</jclouds.version>
-      <jersey-version>1.19</jersey-version>
+      <!--<jersey-version>1.19</jersey-version>-->
       <junit-version>4.12</junit-version>
       <log4j-version>1.2.16</log4j-version>
       <org.springframework.version>3.2.13.RELEASE</org.springframework.version>
-      <shiro-version>1.2.3</shiro-version>
+      <shiro-version>1.2.4</shiro-version>
       <slf4j-version>1.6.1</slf4j-version>
       <snakeyaml-version>1.9</snakeyaml-version>
       <tomcat-version>7.0.59</tomcat-version>
@@ -579,139 +579,139 @@
 
       <!-- Sun and Javax Package Dependencies -->
 
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-core</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-json</artifactId>
-        <version>${jersey-version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.codehaus.jettison</groupId>
-            <artifactId>jettison</artifactId>
-          </exclusion>
-
-          <exclusion>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-core-asl</artifactId>
-          </exclusion>
-
-          <exclusion>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-mapper-asl</artifactId>
-          </exclusion>
-
-          <exclusion>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-jaxrs</artifactId>
-          </exclusion>
-
-          <exclusion>
-            <groupId>org.codehaus.jackson</groupId>
-            <artifactId>jackson-xc</artifactId>
-          </exclusion>
-
-          <exclusion>
-            <groupId>javax.activation</groupId>
-            <artifactId>activation</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
-
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-client</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-server</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>com.sun.jersey</groupId>
-        <artifactId>jersey-grizzly2</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
-
-      <dependency>
-        <groupId>org.glassfish.grizzly</groupId>
-        <artifactId>grizzly-http-servlet-server</artifactId>
-        <version>2.1.2</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey</groupId>-->
+        <!--<artifactId>jersey-core</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.contribs</groupId>
-        <artifactId>jersey-spring</artifactId>
-        <version>${jersey-version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-aop</artifactId>
-          </exclusion>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey</groupId>-->
+        <!--<artifactId>jersey-json</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+        <!--<exclusions>-->
+          <!--<exclusion>-->
+            <!--<groupId>org.codehaus.jettison</groupId>-->
+            <!--<artifactId>jettison</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.codehaus.jackson</groupId>-->
+            <!--<artifactId>jackson-core-asl</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.codehaus.jackson</groupId>-->
+            <!--<artifactId>jackson-mapper-asl</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.codehaus.jackson</groupId>-->
+            <!--<artifactId>jackson-jaxrs</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.codehaus.jackson</groupId>-->
+            <!--<artifactId>jackson-xc</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>javax.activation</groupId>-->
+            <!--<artifactId>activation</artifactId>-->
+          <!--</exclusion>-->
+        <!--</exclusions>-->
+      <!--</dependency>-->
 
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-core</artifactId>
-          </exclusion>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey</groupId>-->
+        <!--<artifactId>jersey-client</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring</artifactId>
-          </exclusion>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey</groupId>-->
+        <!--<artifactId>jersey-server</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-beans</artifactId>
-          </exclusion>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey</groupId>-->
+        <!--<artifactId>jersey-grizzly2</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-          </exclusion>
+      <!--<dependency>-->
+        <!--<groupId>org.glassfish.grizzly</groupId>-->
+        <!--<artifactId>grizzly-http-servlet-server</artifactId>-->
+        <!--<version>2.1.2</version>-->
+      <!--</dependency>-->
 
-          <exclusion>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-          </exclusion>
-        </exclusions>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.contribs</groupId>-->
+        <!--<artifactId>jersey-spring</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+        <!--<exclusions>-->
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring-aop</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring-core</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring-beans</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring-context</artifactId>-->
+          <!--</exclusion>-->
+
+          <!--<exclusion>-->
+            <!--<groupId>org.springframework</groupId>-->
+            <!--<artifactId>spring-web</artifactId>-->
+          <!--</exclusion>-->
+        <!--</exclusions>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.contribs</groupId>
-        <artifactId>jersey-multipart</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.contribs</groupId>-->
+        <!--<artifactId>jersey-multipart</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
-        <artifactId>oauth-signature</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.contribs.jersey-oauth</groupId>-->
+        <!--<artifactId>oauth-signature</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.contribs.jersey-oauth</groupId>
-        <artifactId>oauth-server</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.contribs.jersey-oauth</groupId>-->
+        <!--<artifactId>oauth-server</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.jersey-test-framework</groupId>
-        <artifactId>jersey-test-framework-external</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.jersey-test-framework</groupId>-->
+        <!--<artifactId>jersey-test-framework-external</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
-      <dependency>
-        <groupId>com.sun.jersey.jersey-test-framework</groupId>
-        <artifactId>jersey-test-framework-core</artifactId>
-        <version>${jersey-version}</version>
-      </dependency>
+      <!--<dependency>-->
+        <!--<groupId>com.sun.jersey.jersey-test-framework</groupId>-->
+        <!--<artifactId>jersey-test-framework-core</artifactId>-->
+        <!--<version>${jersey-version}</version>-->
+      <!--</dependency>-->
 
       <dependency>
         <groupId>com.sun.mail</groupId>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index 6c47d82..e95e66f 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -240,46 +240,79 @@
         </dependency>
 
         <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-multipart</artifactId>
+            <groupId>org.glassfish.jersey.containers</groupId>
+            <!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core"  -->
+            <artifactId>jersey-container-servlet</artifactId>
+            <version>2.21</version>
         </dependency>
 
+        <!-- Required only when you are using JAX-RS Client -->
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-json</artifactId>
+            <groupId>org.glassfish.jersey.core</groupId>
+            <artifactId>jersey-client</artifactId>
+            <version>2.21</version>
         </dependency>
 
         <dependency>
-            <groupId>com.fasterxml.jackson.jaxrs</groupId>
-            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <groupId>org.glassfish.jersey.connectors</groupId>
+            <artifactId>jersey-apache-connector</artifactId>
+            <version>2.21</version>
         </dependency>
 
+        <!-- support for JSP and Viewable -->
         <dependency>
-            <groupId>com.fasterxml.jackson.jaxrs</groupId>
-            <artifactId>jackson-jaxrs-json-provider</artifactId>
+            <groupId>org.glassfish.jersey.ext</groupId>
+            <artifactId>jersey-mvc-jsp</artifactId>
+            <version>2.21</version>
         </dependency>
 
-
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-client</artifactId>
+            <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-multipart</artifactId>
+            <version>2.7</version>
         </dependency>
 
         <dependency>
-            <groupId>com.google.code.maven-play-plugin.net.tanesha.recaptcha4j</groupId>
-            <artifactId>recaptcha4j</artifactId>
+            <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-json-jackson</artifactId>
+            <version>2.21</version>
         </dependency>
 
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey.contribs</groupId>-->
+            <!--<artifactId>jersey-multipart</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey</groupId>-->
+            <!--<artifactId>jersey-json</artifactId>-->
+        <!--</dependency>-->
+
         <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-server</artifactId>
+            <groupId>com.fasterxml.jackson.jaxrs</groupId>
+            <artifactId>jackson-jaxrs-json-provider</artifactId>
         </dependency>
 
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey</groupId>-->
+            <!--<artifactId>jersey-client</artifactId>-->
+        <!--</dependency>-->
+
         <dependency>
-            <groupId>com.sun.jersey.contribs</groupId>
-            <artifactId>jersey-spring</artifactId>
+            <groupId>com.google.code.maven-play-plugin.net.tanesha.recaptcha4j</groupId>
+            <artifactId>recaptcha4j</artifactId>
         </dependency>
 
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey</groupId>-->
+            <!--<artifactId>jersey-server</artifactId>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey.contribs</groupId>-->
+            <!--<artifactId>jersey-spring</artifactId>-->
+        <!--</dependency>-->
+
         <!-- Codehaus, Spring, and Other Org Dependencies -->
 
         <dependency>
@@ -382,18 +415,24 @@
             <scope>test</scope>
         </dependency>
 
-        <!--  use the external test client.  Just depend on the maven jetty plugin to launch jetty -->
+        <!--  use the in-memory test setup.  Just depend on the maven jetty plugin to launch jetty -->
         <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-external</artifactId>
-            <scope>test</scope>
+            <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+            <artifactId>jersey-test-framework-provider-inmemory</artifactId>
+            <version>2.21</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.sun.jersey.jersey-test-framework</groupId>
-            <artifactId>jersey-test-framework-core</artifactId>
-            <scope>test</scope>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey.jersey-test-framework</groupId>-->
+            <!--<artifactId>jersey-test-framework-external</artifactId>-->
+            <!--<scope>test</scope>-->
+        <!--</dependency>-->
+
+        <!--<dependency>-->
+            <!--<groupId>com.sun.jersey.jersey-test-framework</groupId>-->
+            <!--<artifactId>jersey-test-framework-core</artifactId>-->
+            <!--<scope>test</scope>-->
+        <!--</dependency>-->
 
         <dependency>
             <groupId>org.apache.usergrid</groupId>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
index 1494814..c10b20f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
@@ -17,41 +17,32 @@
 package org.apache.usergrid.rest;
 
 
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.SecurityContext;
-import javax.ws.rs.core.UriInfo;
-
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.inject.Injector;
-import org.apache.usergrid.persistence.index.EntityIndex;
-import org.springframework.beans.factory.annotation.Autowired;
+import net.tanesha.recaptcha.ReCaptcha;
+import net.tanesha.recaptcha.ReCaptchaFactory;
+import org.apache.commons.lang.StringUtils;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.mq.QueueManagerFactory;
 import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.rest.exceptions.RedirectionException;
 import org.apache.usergrid.security.tokens.TokenService;
 import org.apache.usergrid.services.ServiceManagerFactory;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.core.HttpContext;
-import com.sun.jersey.api.core.ResourceContext;
-import com.sun.jersey.api.view.Viewable;
-import com.sun.jersey.spi.CloseableService;
-
-import net.tanesha.recaptcha.ReCaptcha;
-import net.tanesha.recaptcha.ReCaptchaFactory;
-
-import org.apache.commons.lang.StringUtils;
+import org.glassfish.jersey.server.CloseableService;
+import org.glassfish.jersey.server.mvc.Viewable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ResourceContext;
+import javax.ws.rs.core.*;
+import javax.xml.ws.spi.http.HttpContext;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
 
 
 public abstract class AbstractContextResource {
@@ -187,7 +178,7 @@ public abstract class AbstractContextResource {
         logger.debug("Dispatching to viewable with template: {}",
             template, template_property);
 
-        Viewable viewable = new Viewable(template, model, this.getClass());
+        Viewable viewable = new Viewable(template, model);
         return viewable;
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
index a4a56bc..a785c0b 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
@@ -21,8 +21,8 @@
 package org.apache.usergrid.rest;
 
 
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import com.google.common.base.Preconditions;
-import com.sun.jersey.api.json.JSONWithPadding;
 import org.apache.usergrid.corepersistence.index.ReIndexRequestBuilder;
 import org.apache.usergrid.corepersistence.index.ReIndexRequestBuilderImpl;
 import org.apache.usergrid.corepersistence.index.ReIndexService;
@@ -68,7 +68,7 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @POST
     @Path( "rebuild" )
-    public JSONWithPadding rebuildIndexesPost( @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
+    public ApiResponse rebuildIndexesPost( @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
 
 
@@ -82,7 +82,13 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @GET
     @Path( "rebuild/{jobId}" )
-    public JSONWithPadding rebuildIndexesGet(@PathParam( "jobId" ) String jobId, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesGet(
+        @PathParam( "jobId" ) String jobId,
+        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
+
+
         throws Exception {
         logger.info("Getting status for index jobs");
 
@@ -101,13 +107,15 @@ public class IndexResource extends AbstractContextResource {
         response.setProperty( "numberQueued", status.getNumberProcessed() );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     @RequireSystemAccess
     @PUT
     @Path( "rebuild" )
-    public JSONWithPadding rebuildIndexesPut( final Map<String, Object> payload,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesPut( final Map<String, Object> payload,
                                               @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
 
@@ -122,7 +130,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @POST
     @Path( "rebuild/" + RootResource.APPLICATION_ID_PATH )
-    public JSONWithPadding rebuildIndexesPut( @PathParam( "applicationId" ) String applicationIdStr,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesPut( @PathParam( "applicationId" ) String applicationIdStr,
                                               @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback,
                                               @QueryParam( "delay" ) @DefaultValue( "10" ) final long delay )
 
@@ -143,7 +153,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @PUT
     @Path( "rebuild/" + RootResource.APPLICATION_ID_PATH )
-    public JSONWithPadding rebuildIndexesPut( final Map<String, Object> payload,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesPut( final Map<String, Object> payload,
                                               @PathParam( "applicationId" ) String applicationIdStr,
                                               @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback,
                                               @QueryParam( "delay" ) @DefaultValue( "10" ) final long delay )
@@ -163,7 +175,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @POST
     @Path( "rebuild/" + RootResource.APPLICATION_ID_PATH + "/{collectionName}" )
-    public JSONWithPadding rebuildIndexesPost( @PathParam( "applicationId" ) final String applicationIdStr,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesPost( @PathParam( "applicationId" ) final String applicationIdStr,
                                                @PathParam( "collectionName" ) final String collectionName,
                                                @QueryParam( "reverse" ) @DefaultValue( "false" ) final Boolean reverse,
                                                @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
@@ -184,7 +198,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @PUT
     @Path( "rebuild/" + RootResource.APPLICATION_ID_PATH + "/{collectionName}" )
-    public JSONWithPadding rebuildIndexesPut( final Map<String, Object> payload,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildIndexesPut( final Map<String, Object> payload,
                                               @PathParam( "applicationId" ) final String applicationIdStr,
                                               @PathParam( "collectionName" ) final String collectionName,
                                               @QueryParam( "reverse" ) @DefaultValue( "false" ) final Boolean reverse,
@@ -205,7 +221,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @POST
     @Path( "rebuild/management" )
-    public JSONWithPadding rebuildInternalIndexesPost(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildInternalIndexesPost(
         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception {
 
 
@@ -221,7 +239,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @PUT
     @Path( "rebuild/management" )
-    public JSONWithPadding rebuildInternalIndexesPut( final Map<String, Object> payload,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse rebuildInternalIndexesPut( final Map<String, Object> payload,
                                                       @QueryParam( "callback" ) @DefaultValue( "callback" )
                                                       String callback ) throws Exception {
 
@@ -238,7 +258,9 @@ public class IndexResource extends AbstractContextResource {
     @RequireSystemAccess
     @POST
     @Path(RootResource.APPLICATION_ID_PATH)
-    public JSONWithPadding addIndex( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addIndex( @Context UriInfo ui,
                                      @PathParam( "applicationId" ) final String applicationIdStr,
                                      Map<String, Object> config,
                                      @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
@@ -268,7 +290,7 @@ public class IndexResource extends AbstractContextResource {
             (int) config.get("replicas"), (String) config.get("writeConsistency"));
         response.setAction( "Add index to alias" );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -283,7 +305,7 @@ public class IndexResource extends AbstractContextResource {
     }
 
 
-    private JSONWithPadding executeResumeAndCreateResponse( final Map<String, Object> payload,
+    private ApiResponse executeResumeAndCreateResponse( final Map<String, Object> payload,
                                                             final ReIndexRequestBuilder request,
                                                             final String callback ) {
 
@@ -309,7 +331,7 @@ public class IndexResource extends AbstractContextResource {
     /**
      * Execute the request and return the response.
      */
-    private JSONWithPadding executeAndCreateResponse( final ReIndexRequestBuilder request, final String callback ) {
+    private ApiResponse executeAndCreateResponse( final ReIndexRequestBuilder request, final String callback ) {
 
 
         final ReIndexService.ReIndexStatus status = getReIndexService().rebuildIndex( request );
@@ -323,6 +345,6 @@ public class IndexResource extends AbstractContextResource {
         response.setProperty( "numberQueued", status.getNumberProcessed() );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
index 7410927..168a3b7 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/MigrateResource.java
@@ -19,29 +19,26 @@
 package org.apache.usergrid.rest;
 
 
-import java.util.Map;
-import java.util.Set;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+import com.google.common.base.Preconditions;
+import com.google.inject.Injector;
+import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
+import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
-import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
-import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
-import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Preconditions;
-import com.google.inject.Injector;
-import com.sun.jersey.api.json.JSONWithPadding;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+import java.util.Map;
+import java.util.Set;
 
 
 @Component
@@ -68,7 +65,9 @@ public class MigrateResource extends AbstractContextResource {
     @RequireSystemAccess
     @PUT
     @Path( "run" )
-    public JSONWithPadding migrateData( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse migrateData( @Context UriInfo ui,
                                         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
 
@@ -108,13 +107,15 @@ public class MigrateResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     @RequireSystemAccess
     @PUT
     @Path( "run/{pluginName}" )
-    public JSONWithPadding migrateData(@PathParam("pluginName") String pluginName ,  @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse migrateData(@PathParam("pluginName") String pluginName ,  @Context UriInfo ui,
                                         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
 
@@ -151,13 +152,15 @@ public class MigrateResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     @RequireSystemAccess
     @PUT
     @Path( "set" )
-    public JSONWithPadding setMigrationVersion(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse setMigrationVersion(
         @Context UriInfo ui, Map<String, Object> json,
         @QueryParam( "callback" ) @DefaultValue( "" ) String callback )
         throws Exception {
@@ -197,14 +200,16 @@ public class MigrateResource extends AbstractContextResource {
         response.setData( node );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireSystemAccess
     @GET
     @Path( "status" )
-    public JSONWithPadding migrateStatus(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse migrateStatus(
         @Context UriInfo ui,
         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
@@ -228,14 +233,16 @@ public class MigrateResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireSystemAccess
     @GET
     @Path( "count" )
-    public JSONWithPadding migrateCount(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse migrateCount(
         @Context UriInfo ui,
         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
         throws Exception {
@@ -247,7 +254,7 @@ public class MigrateResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
index 7c17b7c..8875295 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
@@ -19,66 +19,40 @@ package org.apache.usergrid.rest;
 
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.UUID;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.UriInfo;
-
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+import com.google.common.collect.BiMap;
 import com.google.inject.Injector;
+import com.yammer.metrics.Metrics;
+import com.yammer.metrics.core.*;
+import com.yammer.metrics.stats.Snapshot;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.authz.UnauthorizedException;
 import org.apache.usergrid.corepersistence.asyncevents.AsyncEventService;
-import org.apache.usergrid.persistence.index.IndexFig;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
+import org.apache.usergrid.persistence.core.util.Health;
 import org.apache.usergrid.persistence.index.query.Identifier;
-import org.apache.usergrid.persistence.queue.Queue;
-import org.apache.usergrid.persistence.queue.QueueManager;
-import org.apache.usergrid.persistence.queue.QueueManagerFactory;
-import org.apache.usergrid.persistence.queue.QueueScope;
-import org.apache.usergrid.persistence.queue.impl.QueueScopeImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
 import org.apache.usergrid.rest.applications.ApplicationResource;
 import org.apache.usergrid.rest.exceptions.NoOpException;
 import org.apache.usergrid.rest.organizations.OrganizationResource;
 import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
 import org.apache.usergrid.system.UsergridSystemMonitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.authz.UnauthorizedException;
-
-import com.google.common.collect.BiMap;
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.Gauge;
-import com.yammer.metrics.core.Histogram;
-import com.yammer.metrics.core.Metered;
-import com.yammer.metrics.core.Metric;
-import com.yammer.metrics.core.MetricName;
-import com.yammer.metrics.core.MetricProcessor;
-import com.yammer.metrics.core.MetricsRegistry;
-import com.yammer.metrics.core.Sampling;
-import com.yammer.metrics.core.Summarizable;
-import com.yammer.metrics.core.Timer;
-import com.yammer.metrics.stats.Snapshot;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriInfo;
 import java.io.IOException;
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.core.util.Health;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.UUID;
 
 
 /** @author ed@anuff.com */
@@ -121,7 +95,9 @@ public class RootResource extends AbstractContextResource implements MetricProce
     @RequireSystemAccess
     @GET
     @Path("applications")
-    public JSONWithPadding getAllApplications(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getAllApplications(
         @Context UriInfo ui,
         @QueryParam("deleted") @DefaultValue("false") Boolean deleted,
         @QueryParam("callback") @DefaultValue("callback") String callback ) throws URISyntaxException {
@@ -146,14 +122,16 @@ public class RootResource extends AbstractContextResource implements MetricProce
             response.setError( "Unable to retrieve applications" );
         }
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireSystemAccess
     @GET
     @Path("apps")
-    public JSONWithPadding getAllApplications2( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getAllApplications2( @Context UriInfo ui,
                                                 @QueryParam("callback") @DefaultValue("callback") String callback )
             throws URISyntaxException {
         return getAllApplications( ui, false, callback );
@@ -186,7 +164,9 @@ public class RootResource extends AbstractContextResource implements MetricProce
      */
     @GET
     @Path("status")
-    public JSONWithPadding getStatus(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getStatus(
             @QueryParam("ignore_error") @DefaultValue("true") Boolean ignoreError,
             @QueryParam("callback") @DefaultValue("callback") String callback ) {
 
@@ -225,12 +205,14 @@ public class RootResource extends AbstractContextResource implements MetricProce
 
         dumpMetrics(node);
         response.setProperty( "status", node );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @GET
     @Path("lb-status")
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
     public Response getLbStatus() {
         ResponseBuilder response;
         if ( usergridSystemMonitor.getIsCassandraAlive() ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
index fca3333..0a09eba 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
@@ -17,38 +17,17 @@
 package org.apache.usergrid.rest;
 
 
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.EntityManagerFactory;
-import org.apache.usergrid.persistence.EntityManagerFactory.ProgressObserver;
-import org.apache.usergrid.persistence.EntityRef;
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.management.organizations.OrganizationsResource;
-import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
-
-import com.clearspring.analytics.util.Preconditions;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.sun.jersey.api.json.JSONWithPadding;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
 
 
 @Path( "/system" )
@@ -71,7 +50,9 @@ public class SystemResource extends AbstractContextResource {
     @RequireSystemAccess
     @GET
     @Path( "database/setup" )
-    public JSONWithPadding getSetup( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getSetup( @Context UriInfo ui,
                                      @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -88,14 +69,16 @@ public class SystemResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireSystemAccess
     @GET
     @Path( "superuser/setup" )
-    public JSONWithPadding getSetupSuperuser( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getSetupSuperuser( @Context UriInfo ui,
                                               @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -113,7 +96,7 @@ public class SystemResource extends AbstractContextResource {
 
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     @Path( "migrate" )

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
index 546a9f3..f4067df 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/TextToJsonSwapWriter.java
@@ -32,11 +32,13 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.api.view.Viewable;
-import com.sun.jersey.spi.MessageBodyWorkers;
+import org.glassfish.jersey.message.MessageBodyWorkers;
+import org.glassfish.jersey.server.mvc.Viewable;
 
 
+
+// TODO: text to JSON swapping for Jersey 2
+
 /**
  * A writer that will redirect requests for "text/html" to "application/json" if the value
  * returned by the resource is an instance of JSONWithPadding
@@ -46,91 +48,91 @@ import com.sun.jersey.spi.MessageBodyWorkers;
  */
 @Provider
 @Produces( MediaType.TEXT_HTML )
-public class TextToJsonSwapWriter implements MessageBodyWriter<JSONWithPadding> {
-
-
-    private static final MediaType JSON_MEDIA_TYPE = MediaType.APPLICATION_JSON_TYPE;
-
-    @Context
-    MessageBodyWorkers bodyWorker;
-
-
-    @Override
-    public boolean isWriteable( final Class<?> type, final Type genericType, final Annotation[] annotations,
-                                final MediaType mediaType ) {
-
-
-        // if type is Viewable them we want to return HTML, so no swap needed
-        if ( type.isAssignableFrom(Viewable.class) ) {
-            return false;
-        }
-
-        // this should only map no media type, or text/html requests with json responses
-        final boolean mediaTypeCorrect = mediaType == null || MediaType.TEXT_HTML_TYPE.equals( mediaType );
-
-        if(!mediaTypeCorrect){
-            return false;
-        }
-
-        return true;
-
-// JsonSerializableWithType no longer exists in FasterXML Jackson
+public class TextToJsonSwapWriter { // implements MessageBodyWriter<JSONWithPadding> {
 //
-//        final boolean serializableAnnotation = type.getAnnotation( XmlRootElement.class ) != null;
-//        final boolean jsonSerializable = JsonSerializableWithType.class.isAssignableFrom( type );
-//        return serializableAnnotation || jsonSerializable;
-    }
-
-
-    @Override
-    public long getSize( final JSONWithPadding jsonWithPadding, final Class<?> type, final Type genericType,
-                         final Annotation[] annotations, final MediaType mediaType ) {
-        return -1;
-    }
-
-
-    @Override
-    public void writeTo( final JSONWithPadding jsonWithPadding, final Class<?> type, final Type genericType,
-                         final Annotation[] annotations, final MediaType mediaType,
-                         final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream )
-            throws IOException, WebApplicationException {
-
-
-        Object jsonEntity = jsonWithPadding.getJsonSource();
-        Type entityGenericType = jsonEntity.getClass();
-        Class<?> entityType = jsonEntity.getClass();
-
-        final boolean genericEntityUsed = jsonEntity instanceof GenericEntity;
-
-        if ( genericEntityUsed ) {
-            GenericEntity ge = ( GenericEntity ) jsonEntity;
-            jsonEntity = ge.getEntity();
-            entityGenericType = ge.getType();
-            entityType = ge.getRawType();
-        }
-
-
-        //replace the text/html content type with application Json
-        httpHeaders.remove( HttpHeaders.CONTENT_TYPE);
-
-        httpHeaders.putSingle( HttpHeaders.CONTENT_TYPE,  JSON_MEDIA_TYPE);
-
-
-
-
-        MessageBodyWriter bw = bodyWorker.getMessageBodyWriter( entityType, entityGenericType, annotations, JSON_MEDIA_TYPE );
-
-        if ( bw == null ) {
-
-            throw new RuntimeException( "Couldn't find the serailziation writer for json type");
-        }
-
-
-
-
-        bw.writeTo( jsonEntity, entityType, entityGenericType, annotations, JSON_MEDIA_TYPE, httpHeaders,
-                entityStream );
-
-
-    }
+//
+//    private static final MediaType JSON_MEDIA_TYPE = MediaType.APPLICATION_JSON_TYPE;
+//
+//    @Context
+//    MessageBodyWorkers bodyWorker;
+//
+//
+//    @Override
+//    public boolean isWriteable( final Class<?> type, final Type genericType, final Annotation[] annotations,
+//                                final MediaType mediaType ) {
+//
+//
+//        // if type is Viewable them we want to return HTML, so no swap needed
+//        if ( type.isAssignableFrom(Viewable.class) ) {
+//            return false;
+//        }
+//
+//        // this should only map no media type, or text/html requests with json responses
+//        final boolean mediaTypeCorrect = mediaType == null || MediaType.TEXT_HTML_TYPE.equals( mediaType );
+//
+//        if(!mediaTypeCorrect){
+//            return false;
+//        }
+//
+//        return true;
+//
+//// JsonSerializableWithType no longer exists in FasterXML Jackson
+////
+////        final boolean serializableAnnotation = type.getAnnotation( XmlRootElement.class ) != null;
+////        final boolean jsonSerializable = JsonSerializableWithType.class.isAssignableFrom( type );
+////        return serializableAnnotation || jsonSerializable;
+//    }
+//
+//
+//    @Override
+//    public long getSize( final JSONWithPadding jsonWithPadding, final Class<?> type, final Type genericType,
+//                         final Annotation[] annotations, final MediaType mediaType ) {
+//        return -1;
+//    }
+//
+//
+//    @Override
+//    public void writeTo( final JSONWithPadding jsonWithPadding, final Class<?> type, final Type genericType,
+//                         final Annotation[] annotations, final MediaType mediaType,
+//                         final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream )
+//            throws IOException, WebApplicationException {
+//
+//
+//        Object jsonEntity = jsonWithPadding.getJsonSource();
+//        Type entityGenericType = jsonEntity.getClass();
+//        Class<?> entityType = jsonEntity.getClass();
+//
+//        final boolean genericEntityUsed = jsonEntity instanceof GenericEntity;
+//
+//        if ( genericEntityUsed ) {
+//            GenericEntity ge = ( GenericEntity ) jsonEntity;
+//            jsonEntity = ge.getEntity();
+//            entityGenericType = ge.getType();
+//            entityType = ge.getRawType();
+//        }
+//
+//
+//        //replace the text/html content type with application Json
+//        httpHeaders.remove( HttpHeaders.CONTENT_TYPE);
+//
+//        httpHeaders.putSingle( HttpHeaders.CONTENT_TYPE,  JSON_MEDIA_TYPE);
+//
+//
+//
+//
+//        MessageBodyWriter bw = bodyWorker.getMessageBodyWriter( entityType, entityGenericType, annotations, JSON_MEDIA_TYPE );
+//
+//        if ( bw == null ) {
+//
+//            throw new RuntimeException( "Couldn't find the serailziation writer for json type");
+//        }
+//
+//
+//
+//
+//        bw.writeTo( jsonEntity, entityType, entityGenericType, annotations, JSON_MEDIA_TYPE, httpHeaders,
+//                entityStream );
+//
+//
+//    }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
index c49c543..f2bd8fc 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
@@ -38,6 +38,9 @@ import javax.ws.rs.core.PathSegment;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+import org.apache.usergrid.rest.ApiResponse;
+import org.glassfish.jersey.server.mvc.Viewable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
@@ -73,9 +76,6 @@ import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
 import org.apache.usergrid.security.oauth.AccessInfo;
 import org.apache.usergrid.security.oauth.ClientCredentialsInfo;
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.api.view.Viewable;
-
 import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
 import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED;
@@ -354,7 +354,9 @@ public class ApplicationResource extends ServiceResource {
     @GET
     @Path("credentials")
     @RequireApplicationAccess
-    public JSONWithPadding getKeys( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getKeys( @Context UriInfo ui,
                                     @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -368,17 +370,16 @@ public class ApplicationResource extends ServiceResource {
                 new ClientCredentialsInfo( management.getClientIdForApplication( services.getApplicationId() ),
                         management.getClientSecretForApplication( services.getApplicationId() ) );
 
-        return new JSONWithPadding(
-                createApiResponse().withCredentials( kp ).withAction( "get application keys" ).withSuccess(),
-                callback );
+        return   createApiResponse().withCredentials( kp ).withAction( "get application keys" ).withSuccess();
     }
 
 
     @POST
     @Path("credentials")
     @RequireApplicationAccess
-    @Produces(MediaType.APPLICATION_JSON)
-    public JSONWithPadding generateKeys( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse generateKeys( @Context UriInfo ui,
         @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
 
         logger.debug( "AuthResource.keys" );
@@ -391,9 +392,7 @@ public class ApplicationResource extends ServiceResource {
             management.getClientIdForApplication( services.getApplicationId() ),
             management.newClientSecretForApplication( services.getApplicationId() ) );
 
-        return new JSONWithPadding(
-                createApiResponse().withCredentials( kp ).withAction( "generate application keys" ).withSuccess(),
-                callback );
+        return createApiResponse().withCredentials( kp ).withAction( "generate application keys" ).withSuccess();
     }
 
 
@@ -498,7 +497,7 @@ public class ApplicationResource extends ServiceResource {
     @Override
     @DELETE
     @RequireOrganizationAccess
-    public JSONWithPadding executeDelete( @Context final UriInfo ui, @DefaultValue( "callback" ) final String callback,
+    public ApiResponse executeDelete( @Context final UriInfo ui, @DefaultValue( "callback" ) final String callback,
                                           final String confirmAppDelete ) throws Exception {
         throw new UnsupportedOperationException( "Delete must be done from the management endpoint" );
     }
@@ -599,7 +598,9 @@ public class ApplicationResource extends ServiceResource {
 
     @GET
     @Path("apm/apigeeMobileConfig")
-    public JSONWithPadding getAPMConfig( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public Object getAPMConfig( @Context UriInfo ui,
                                          @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
         EntityManager em = emf.getEntityManager( applicationId );
@@ -610,6 +611,6 @@ public class ApplicationResource extends ServiceResource {
             value = management.registerAppWithAPM( management.getOrganizationForApplication( applicationId ),
                     management.getApplicationInfo( applicationId ) );
         }
-        return new JSONWithPadding( value, callback );
+        return value;
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
index 9a5a403..6e10a9f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
@@ -17,40 +17,9 @@
 package org.apache.usergrid.rest.applications;
 
 
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.commons.lang.StringUtils;
-
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.Query;
@@ -61,12 +30,7 @@ import org.apache.usergrid.rest.RootResource;
 import org.apache.usergrid.rest.applications.assets.AssetsResource;
 import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
 import org.apache.usergrid.security.oauth.AccessInfo;
-import org.apache.usergrid.services.ServiceAction;
-import org.apache.usergrid.services.ServiceManager;
-import org.apache.usergrid.services.ServiceParameter;
-import org.apache.usergrid.services.ServicePayload;
-import org.apache.usergrid.services.ServiceRequest;
-import org.apache.usergrid.services.ServiceResults;
+import org.apache.usergrid.services.*;
 import org.apache.usergrid.services.assets.data.AssetUtils;
 import org.apache.usergrid.services.assets.data.AwsSdkS3BinaryStore;
 import org.apache.usergrid.services.assets.data.BinaryStore;
@@ -74,16 +38,22 @@ import org.apache.usergrid.services.assets.data.LocalFileBinaryStore;
 import org.apache.usergrid.services.exceptions.AwsPropertiesNotFoundException;
 import org.apache.usergrid.utils.InflectionUtils;
 import org.apache.usergrid.utils.JsonUtils;
+import org.glassfish.jersey.media.multipart.BodyPart;
+import org.glassfish.jersey.media.multipart.BodyPartEntity;
+import org.glassfish.jersey.media.multipart.FormDataBodyPart;
+import org.glassfish.jersey.media.multipart.FormDataMultiPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.multipart.BodyPart;
-import com.sun.jersey.multipart.BodyPartEntity;
-import com.sun.jersey.multipart.FormDataBodyPart;
-import com.sun.jersey.multipart.FormDataMultiPart;
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
+import java.io.InputStream;
+import java.util.*;
 
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
-
 import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_USERGRID_BINARY_UPLOADER;
 
 
@@ -306,9 +276,10 @@ public class ServiceResource extends AbstractContextResource {
 
 
     @GET
-    @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_HTML})
+    @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_HTML, "application/javascript"})
     @RequireApplicationAccess
-    public JSONWithPadding executeGet( @Context UriInfo ui,
+    @JSONP
+    public ApiResponse executeGet( @Context UriInfo ui,
                                        @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -322,7 +293,7 @@ public class ServiceResource extends AbstractContextResource {
 
         executeServiceRequest( ui, response, ServiceAction.GET, null );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -358,7 +329,7 @@ public class ServiceResource extends AbstractContextResource {
      * Necessary to work around inexplicable problems with EntityHolder.
      * See above.
      */
-    public JSONWithPadding executePostWithObject( @Context UriInfo ui, Object json,
+    public ApiResponse executePostWithObject( @Context UriInfo ui, Object json,
             @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
 
         logger.debug( "ServiceResource.executePostWithMap" );
@@ -374,7 +345,7 @@ public class ServiceResource extends AbstractContextResource {
 
         executeServiceRequest( ui, response, ServiceAction.POST, payload );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -382,7 +353,7 @@ public class ServiceResource extends AbstractContextResource {
      * Necessary to work around inexplicable problems with EntityHolder.
      * See above.
      */
-    public JSONWithPadding executePutWithMap( @Context UriInfo ui, Map<String, Object> json,
+    public ApiResponse executePutWithMap( @Context UriInfo ui, Map<String, Object> json,
             @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
 
         ApiResponse response = createApiResponse();
@@ -396,14 +367,16 @@ public class ServiceResource extends AbstractContextResource {
 
         executeServiceRequest( ui, response, ServiceAction.PUT, payload );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @POST
     @RequireApplicationAccess
     @Consumes(MediaType.APPLICATION_JSON)
-    public JSONWithPadding executePost( @Context UriInfo ui, String body,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executePost( @Context UriInfo ui, String body,
             @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
 
         logger.debug( "ServiceResource.executePost: body = " + body );
@@ -426,7 +399,7 @@ public class ServiceResource extends AbstractContextResource {
 
         executeServiceRequest( ui, response, ServiceAction.POST, payload );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -434,7 +407,9 @@ public class ServiceResource extends AbstractContextResource {
     @PUT
     @RequireApplicationAccess
     @Consumes(MediaType.APPLICATION_JSON)
-    public JSONWithPadding executePut( @Context UriInfo ui, String body,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executePut( @Context UriInfo ui, String body,
                                        @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -449,7 +424,9 @@ public class ServiceResource extends AbstractContextResource {
 
     @DELETE
     @RequireApplicationAccess
-    public JSONWithPadding executeDelete(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeDelete(
         @Context UriInfo ui,
         @QueryParam("callback") @DefaultValue("callback") String callback,
         @QueryParam("app_delete_confirm") String confirmAppDelete )
@@ -482,7 +459,7 @@ public class ServiceResource extends AbstractContextResource {
             }
         }
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     //    TODO Temporarily removed until we test further
@@ -566,7 +543,9 @@ public class ServiceResource extends AbstractContextResource {
     @POST
     @RequireApplicationAccess
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public JSONWithPadding executeMultiPartPost( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeMultiPartPost( @Context UriInfo ui,
                                                  @QueryParam("callback") @DefaultValue("callback") String callback,
                                                  FormDataMultiPart multiPart ) throws Exception {
 
@@ -578,7 +557,9 @@ public class ServiceResource extends AbstractContextResource {
     @PUT
     @RequireApplicationAccess
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public JSONWithPadding executeMultiPartPut( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeMultiPartPut( @Context UriInfo ui,
                                                 @QueryParam("callback") @DefaultValue("callback") String callback,
                                                 FormDataMultiPart multiPart ) throws Exception {
 
@@ -587,7 +568,9 @@ public class ServiceResource extends AbstractContextResource {
     }
 
 
-    private JSONWithPadding executeMultiPart( UriInfo ui, String callback, FormDataMultiPart multiPart,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    private ApiResponse executeMultiPart( UriInfo ui, String callback, FormDataMultiPart multiPart,
                                               ServiceAction serviceAction ) throws Exception {
 
         //needed for testing
@@ -627,7 +610,7 @@ public class ServiceResource extends AbstractContextResource {
 
         // process file part
         if ( fileBodyPart != null ) {
-            InputStream fileInput = ( ( BodyPartEntity ) fileBodyPart.getEntity() ).getInputStream();
+            InputStream fileInput = ( (BodyPartEntity) fileBodyPart.getEntity() ).getInputStream();
             if ( fileInput != null ) {
                 Entity entity = serviceResults.getEntity();
                 EntityManager em = emf.getEntityManager( getApplicationId() );
@@ -647,7 +630,7 @@ public class ServiceResource extends AbstractContextResource {
             }
         }
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/assets/AssetsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/assets/AssetsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/assets/AssetsResource.java
index fedffc4..4e2e6bb 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/assets/AssetsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/assets/AssetsResource.java
@@ -18,11 +18,11 @@ package org.apache.usergrid.rest.applications.assets;
 
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.multipart.FormDataParam;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.entities.Asset;
 import org.apache.usergrid.rest.AbstractContextResource;
+import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.applications.ServiceResource;
 import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
 import org.apache.usergrid.services.assets.data.AssetUtils;
@@ -30,6 +30,7 @@ import org.apache.usergrid.services.assets.data.AwsSdkS3BinaryStore;
 import org.apache.usergrid.services.assets.data.BinaryStore;
 import org.apache.usergrid.services.assets.data.LocalFileBinaryStore;
 import org.apache.usergrid.utils.StringUtils;
+import org.glassfish.jersey.media.multipart.FormDataParam;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -80,7 +81,9 @@ public class AssetsResource extends ServiceResource {
     @Override
     @RequireApplicationAccess
     @GET
-    public JSONWithPadding executeGet( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeGet( @Context UriInfo ui,
                                        @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
         logger.info( "In AssetsResource.executeGet with ui: {} and callback: {}", ui, callback );
@@ -92,7 +95,9 @@ public class AssetsResource extends ServiceResource {
     @PUT
     @RequireApplicationAccess
     @Consumes(MediaType.APPLICATION_JSON)
-    public JSONWithPadding executePut( @Context UriInfo ui, String body,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executePut( @Context UriInfo ui, String body,
                                        @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/events/EventsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/events/EventsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/events/EventsResource.java
index ec6c937..5c528bd 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/events/EventsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/events/EventsResource.java
@@ -17,26 +17,25 @@
 package org.apache.usergrid.rest.applications.events;
 
 
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.usergrid.mq.QueuePosition;
 import org.apache.usergrid.mq.QueueQuery;
 import org.apache.usergrid.mq.QueueResults;
 import org.apache.usergrid.persistence.entities.User;
 import org.apache.usergrid.rest.applications.ApplicationResource;
 import org.apache.usergrid.rest.applications.ServiceResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-import com.sun.jersey.api.json.JSONWithPadding;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
 
 
 @Component("org.apache.usergrid.rest.applications.events.EventsResource")
@@ -54,17 +53,18 @@ public class EventsResource extends ServiceResource {
     }
 
 
-    @Override
     @GET
-    public JSONWithPadding executeGet( @Context UriInfo ui,
-                                       @QueryParam("callback") @DefaultValue("callback") String callback )
-            throws Exception {
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public QueueResults executeQueueGet(
+        @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
+
         QueueQuery query = QueueQuery.fromQueryParams( ui.getQueryParameters() );
         if ( query == null ) {
             query = new QueueQuery();
         }
         query.setPosition( QueuePosition.START );
         QueueResults results = ( ( ApplicationResource ) parent ).getQueues().getFromQueue( "/events", query );
-        return new JSONWithPadding( results, callback );
+        return results;
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
index 72883b0..1997601 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
@@ -16,11 +16,15 @@
  */
 package org.apache.usergrid.rest.applications.notifiers;
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.multipart.FormDataMultiPart;
-import java.io.InputStream;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.commons.io.IOUtils;
 import org.apache.usergrid.persistence.index.query.Identifier;
+import org.apache.usergrid.rest.ApiResponse;
+import org.apache.usergrid.rest.applications.ServiceResource;
+import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
+import org.apache.usergrid.services.ServiceAction;
+import org.apache.usergrid.services.ServicePayload;
+import org.glassfish.jersey.media.multipart.FormDataMultiPart;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
@@ -30,15 +34,10 @@ import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.UriInfo;
+import java.io.InputStream;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 
-import org.apache.usergrid.rest.ApiResponse;
-import org.apache.usergrid.rest.applications.ServiceResource;
-import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
-import org.apache.usergrid.services.ServiceAction;
-import org.apache.usergrid.services.ServicePayload;
-
 @Component("org.apache.usergrid.rest.applications.notifiers.NotifierResource")
 @Scope("prototype")
 @Produces(MediaType.APPLICATION_JSON)
@@ -57,16 +56,18 @@ public class NotifierResource extends ServiceResource {
     @PUT
     @RequireApplicationAccess
     @Consumes(MediaType.MULTIPART_FORM_DATA)
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
     @Override
-    public JSONWithPadding executeMultiPartPut(@Context UriInfo ui,
+    public ApiResponse executeMultiPartPut(@Context UriInfo ui,
         @QueryParam("callback") @DefaultValue("callback") String callback,
         FormDataMultiPart multiPart) throws Exception {
 
         logger.debug("NotifierResource.executePut");
 
-        String name =         getValueOrNull(multiPart, "name"); 
-        String provider =     getValueOrNull(multiPart, "provider"); 
-        String certPassword = getValueOrNull(multiPart, "certificatePassword"); 
+        String name =         getValueOrNull(multiPart, "name");
+        String provider =     getValueOrNull(multiPart, "provider");
+        String certPassword = getValueOrNull(multiPart, "certificatePassword");
 
         InputStream is = null;
         if (multiPart.getField("p12Certificate") != null) {
@@ -90,7 +91,7 @@ public class NotifierResource extends ServiceResource {
         ServicePayload payload = getPayload(properties);
         executeServiceRequest(ui, response, ServiceAction.PUT, payload);
 
-        return new JSONWithPadding(response, callback);
+        return response;
     }
 
     private String getValueOrNull(FormDataMultiPart multiPart, String name) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
index 1787be5..b72a857 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
@@ -16,35 +16,32 @@
  */
 package org.apache.usergrid.rest.applications.notifiers;
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.multipart.FormDataMultiPart;
-import java.io.InputStream;
-import java.util.HashMap;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.commons.io.IOUtils;
-
 import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.persistence.index.query.Identifier;
+import org.apache.usergrid.rest.AbstractContextResource;
+import org.apache.usergrid.rest.ApiResponse;
+import org.apache.usergrid.rest.applications.ServiceResource;
+import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
+import org.apache.usergrid.services.ServiceAction;
+import org.apache.usergrid.services.ServicePayload;
+import org.glassfish.jersey.media.multipart.FormDataMultiPart;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
-
 import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.PathSegment;
 import javax.ws.rs.core.UriInfo;
+import java.io.InputStream;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.UUID;
 
-import org.apache.usergrid.rest.AbstractContextResource;
-import org.apache.usergrid.rest.ApiResponse;
-import org.apache.usergrid.rest.applications.ServiceResource;
-import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
-import org.apache.usergrid.services.ServiceAction;
-import org.apache.usergrid.services.ServicePayload;
-
 import static org.apache.usergrid.services.ServiceParameter.addParameter;
 
 @Component("org.apache.usergrid.rest.applications.notifiers.NotifiersResource")
@@ -106,7 +103,9 @@ public class NotifiersResource extends ServiceResource {
     @RequireApplicationAccess
     @Consumes(MediaType.MULTIPART_FORM_DATA)
     @Override
-    public JSONWithPadding executeMultiPartPost(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeMultiPartPost(
             @Context UriInfo ui,
             @QueryParam("callback") @DefaultValue("callback") String callback,
             FormDataMultiPart multiPart)
@@ -142,7 +141,7 @@ public class NotifiersResource extends ServiceResource {
         ServicePayload payload = getPayload(certProps);
         executeServiceRequest(ui, response, ServiceAction.POST, payload);
 
-        return new JSONWithPadding(response, callback);
+        return response;
     }
 
     private String getValueOrNull(FormDataMultiPart multiPart, String name) {


Mime
View raw message