usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [05/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:31 GMT
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
index 13489a3..9398f0e 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
@@ -17,40 +17,30 @@
 package org.apache.usergrid.rest.management.organizations;
 
 
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-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 org.apache.usergrid.rest.RootResource;
-import org.apache.usergrid.rest.management.ManagementResource;
-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.jaxrs.json.annotation.JSONP;
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang.StringUtils;
 import org.apache.usergrid.management.ApplicationCreator;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.OrganizationOwnerInfo;
 import org.apache.usergrid.management.exceptions.ManagementException;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
+import org.apache.usergrid.rest.RootResource;
+import org.apache.usergrid.rest.management.ManagementResource;
 import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
+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 com.google.common.base.Preconditions;
-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.UUID;
 
 
 @Component( "org.apache.usergrid.rest.management.organizations.OrganizationsResource" )
@@ -101,7 +91,9 @@ public class OrganizationsResource extends AbstractContextResource {
 
     @POST
     @Consumes( MediaType.APPLICATION_JSON )
-    public JSONWithPadding newOrganization( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newOrganization( @Context UriInfo ui, Map<String, Object> json,
                                             @QueryParam( "callback" ) @DefaultValue( "" ) String callback )
             throws Exception {
 
@@ -126,7 +118,9 @@ public class OrganizationsResource extends AbstractContextResource {
 
     @POST
     @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
-    public JSONWithPadding newOrganizationFromForm( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newOrganizationFromForm( @Context UriInfo ui,
                                                     @FormParam( "organization" ) String organizationNameForm,
                                                     @QueryParam( "organization" ) String organizationNameQuery,
                                                     @FormParam( "username" ) String usernameForm,
@@ -153,7 +147,9 @@ public class OrganizationsResource extends AbstractContextResource {
 
 
     /** Create a new organization */
-    private JSONWithPadding newOrganization( @Context UriInfo ui, String organizationName, String username, String name,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    private ApiResponse newOrganization( @Context UriInfo ui, String organizationName, String username, String name,
                                              String email, String password, Map<String, Object> userProperties,
                                              Map<String, Object> orgProperties, String callback ) throws Exception {
 
@@ -191,7 +187,7 @@ public class OrganizationsResource extends AbstractContextResource {
         response.setSuccess();
 
         logger.info( "New organization complete: {}", organizationName );
-        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/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index bcec775..ae60123 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@ -17,16 +17,17 @@
 package org.apache.usergrid.rest.management.organizations.applications;
 
 
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import com.google.common.base.Preconditions;
-import com.sun.jersey.api.json.JSONWithPadding;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.amber.oauth2.common.message.OAuthResponse;
 import org.apache.commons.lang.NullArgumentException;
 import org.apache.commons.lang.StringUtils;
-
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.export.ExportService;
+import org.apache.usergrid.persistence.EntityManager;
+import org.apache.usergrid.persistence.core.util.Health;
 import org.apache.usergrid.persistence.queue.impl.UsergridAwsCredentials;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
@@ -38,7 +39,6 @@ import org.apache.usergrid.security.oauth.ClientCredentialsInfo;
 import org.apache.usergrid.security.providers.SignInAsProvider;
 import org.apache.usergrid.security.providers.SignInProviderFactory;
 import org.apache.usergrid.services.ServiceManager;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,14 +55,8 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.UUID;
 
-import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
-import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
-import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
-import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
-import static javax.servlet.http.HttpServletResponse.SC_OK;
+import static javax.servlet.http.HttpServletResponse.*;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-import org.apache.usergrid.persistence.EntityManager;
-import org.apache.usergrid.persistence.core.util.Health;
 
 
 @Component("org.apache.usergrid.rest.management.organizations.applications.ApplicationResource")
@@ -112,7 +106,9 @@ public class ApplicationResource extends AbstractContextResource {
 
     @RequireOrganizationAccess
     @GET
-    public JSONWithPadding getApplication(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getApplication(
             @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback )
         throws Exception {
 
@@ -122,14 +118,16 @@ public class ApplicationResource extends AbstractContextResource {
         response.setApplication( sm.getApplication() );
         response.setParams( ui.getQueryParameters() );
         response.setResults( management.getApplicationMetadata( applicationId ) );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @GET
     @Path("credentials")
-    public JSONWithPadding getCredentials(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getCredentials(
             @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback )
         throws Exception {
 
@@ -141,14 +139,16 @@ public class ApplicationResource extends AbstractContextResource {
                         management.getClientSecretForApplication( applicationId ) );
 
         response.setCredentials( credentials );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @POST
     @Path("credentials")
-    public JSONWithPadding generateCredentials( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse generateCredentials( @Context UriInfo ui,
             @QueryParam("callback") @DefaultValue("callback") String callback )
         throws Exception {
 
@@ -160,7 +160,7 @@ public class ApplicationResource extends AbstractContextResource {
                         management.newClientSecretForApplication( applicationId ) );
 
         response.setCredentials( credentials );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -168,7 +168,9 @@ public class ApplicationResource extends AbstractContextResource {
     @Path("sia-provider")
     @Consumes(APPLICATION_JSON)
     @RequireOrganizationAccess
-    public JSONWithPadding configureProvider(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse configureProvider(
             @Context UriInfo ui,
             @QueryParam("provider_key") String siaProvider,
             Map<String, Object> json,
@@ -200,7 +202,7 @@ public class ApplicationResource extends AbstractContextResource {
 
         signInAsProvider.saveToConfiguration( json );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
     @POST
@@ -393,7 +395,9 @@ public class ApplicationResource extends AbstractContextResource {
      */
     @PUT
     @RequireOrganizationAccess
-    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 {
 
         if ( applicationId == null ) {
@@ -407,13 +411,15 @@ public class ApplicationResource extends AbstractContextResource {
         response.setApplication( emf.getEntityManager( applicationId ).getApplication() );
         response.setParams( ui.getQueryParameters() );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @DELETE
     @RequireOrganizationAccess
-    public JSONWithPadding executeDelete(  @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse executeDelete(  @Context UriInfo ui,
         @QueryParam("callback") @DefaultValue("callback") String callback,
         @QueryParam("app_delete_confirm") String confirmDelete) throws Exception {
 
@@ -445,7 +451,7 @@ public class ApplicationResource extends AbstractContextResource {
 
         logger.debug( "ApplicationResource.delete() sending response ");
 
-        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/management/organizations/applications/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
index 28eff4e..ef9a5f4 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
@@ -17,30 +17,28 @@
 package org.apache.usergrid.rest.management.organizations.applications;
 
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.usergrid.rest.RootResource;
-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 com.google.common.base.Preconditions;
+import com.google.common.collect.BiMap;
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
+import org.apache.usergrid.rest.RootResource;
 import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.BiMap;
-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.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
 
 import static org.apache.commons.lang.StringUtils.isEmpty;
 
@@ -70,7 +68,9 @@ public class ApplicationsResource extends AbstractContextResource {
 
     @RequireOrganizationAccess
     @GET
-    public JSONWithPadding getOrganizationApplications(
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getOrganizationApplications(
         @Context UriInfo ui,
         @QueryParam( "deleted" ) @DefaultValue( "false" ) Boolean deleted, // only return deleted apps if true
         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception {
@@ -81,14 +81,16 @@ public class ApplicationsResource extends AbstractContextResource {
         BiMap<UUID, String> applications = management.getApplicationsForOrganization( organization.getUuid() );
         response.setData( applications.inverse() );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @POST
     @Consumes( MediaType.APPLICATION_JSON )
-    public JSONWithPadding newApplicationForOrganization( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newApplicationForOrganization( @Context UriInfo ui, Map<String, Object> json,
                                                           @QueryParam( "callback" ) @DefaultValue( "callback" )
                                                           String callback ) throws Exception {
         String applicationName = ( String ) json.get( "name" );
@@ -99,7 +101,9 @@ public class ApplicationsResource extends AbstractContextResource {
     @RequireOrganizationAccess
     @POST
     @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
-    public JSONWithPadding newApplicationForOrganizationFromForm( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newApplicationForOrganizationFromForm( @Context UriInfo ui, Map<String, Object> json,
                                                                   @QueryParam( "callback" ) @DefaultValue( "callback" )
                                                                   String callback,
                                                                   @FormParam( "name" ) String applicationName )
@@ -119,7 +123,7 @@ public class ApplicationsResource extends AbstractContextResource {
         applications.put( applicationInfo.getName(), applicationInfo.getId() );
         response.setData( applications );
         response.setResults( management.getApplicationMetadata( applicationInfo.getId() ) );
-        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/management/organizations/applications/imports/FileErrorsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileErrorsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileErrorsResource.java
index a72a8f0..d9fc009 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileErrorsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileErrorsResource.java
@@ -20,23 +20,7 @@
 package org.apache.usergrid.rest.management.organizations.applications.imports;
 
 
-import java.util.Collections;
-import java.util.UUID;
-
-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.PathSegment;
-import javax.ws.rs.core.UriInfo;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.importer.ImportService;
 import org.apache.usergrid.persistence.Entity;
@@ -46,8 +30,17 @@ import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-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.PathSegment;
+import javax.ws.rs.core.UriInfo;
+import java.util.Collections;
+import java.util.UUID;
 
 
 @Component("org.apache.usergrid.rest.management.organizations.applications.imports.FileErrorsResource")
@@ -82,7 +75,9 @@ public class FileErrorsResource extends AbstractContextResource {
 
 
     @GET
-    public JSONWithPadding getFileIncludes( @Context UriInfo ui, @QueryParam( "ql" ) String query, @QueryParam( "cursor" ) String cursor )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getFileIncludes( @Context UriInfo ui, @QueryParam( "ql" ) String query, @QueryParam( "cursor" ) String cursor )
           throws Exception {
 
 
@@ -103,13 +98,15 @@ public class FileErrorsResource extends AbstractContextResource {
 
           response.withResults( importResults );
 
-          return new JSONWithPadding( response );
+          return response;
 
       }
 
     @GET
     @Path( RootResource.ENTITY_ID_PATH )
-    public JSONWithPadding getFileIncludeById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getFileIncludeById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
         throws Exception {
 
         final UUID failedEntity = UUID.fromString( entityId.getPath() );
@@ -131,7 +128,7 @@ public class FileErrorsResource extends AbstractContextResource {
 
         response.setEntities( Collections.<Entity>singletonList( importEntity ) );
 
-        return new JSONWithPadding( response );
+        return response;
 
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
index 1cb44d0..708aa80 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.PathSegment;
 import javax.ws.rs.core.UriInfo;
 
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
@@ -47,8 +48,6 @@ import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
 
-import com.sun.jersey.api.json.JSONWithPadding;
-
 
 @Component("org.apache.usergrid.rest.management.organizations.applications.imports.FileIncludesResource")
 @Scope("prototype")
@@ -80,7 +79,9 @@ public class FileIncludesResource extends AbstractContextResource {
 
 
     @GET
-    public JSONWithPadding getFileIncludes( @Context UriInfo ui, @QueryParam( "ql" ) String query, @QueryParam( "cursor" ) String cursor )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getFileIncludes( @Context UriInfo ui, @QueryParam( "ql" ) String query, @QueryParam( "cursor" ) String cursor )
           throws Exception {
 
 
@@ -100,13 +101,15 @@ public class FileIncludesResource extends AbstractContextResource {
 
           response.withResults( importResults );
 
-          return new JSONWithPadding( response );
+        return response;
 
       }
 
     @GET
     @Path( RootResource.ENTITY_ID_PATH )
-    public JSONWithPadding getFileIncludeById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getFileIncludeById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
         throws Exception {
 
         final UUID fileIncludeId = UUID.fromString( entityId.getPath() );
@@ -126,7 +129,7 @@ public class FileIncludesResource extends AbstractContextResource {
 
         response.setEntities( Collections.<Entity>singletonList( importEntity ) );
 
-        return new JSONWithPadding( response );
+        return response;
 
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
index 5755c8e..d829f80 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
@@ -20,31 +20,8 @@
 package org.apache.usergrid.rest.management.organizations.applications.imports;
 
 
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-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.PathSegment;
-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.jaxrs.json.annotation.JSONP;
 import org.apache.commons.lang.NullArgumentException;
-
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.importer.ImportService;
@@ -56,8 +33,20 @@ import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
 import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
+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.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.PathSegment;
+import javax.ws.rs.core.UriInfo;
+import java.util.Collections;
+import java.util.Map;
+import java.util.UUID;
 
 
 @Component( "org.apache.usergrid.rest.management.organizations.applications.imports.ImportsResource" )
@@ -93,7 +82,9 @@ public class ImportsResource extends AbstractContextResource {
     @POST
     @RequireOrganizationAccess
     @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 {
 
@@ -142,12 +133,14 @@ public class ImportsResource extends AbstractContextResource {
 
         response.setEntities( Collections.<Entity>singletonList( importEntity ) );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @GET
-    public JSONWithPadding getImports( @Context UriInfo ui, @QueryParam( "ql" ) String query,  @QueryParam( "cursor" ) String cursor ) throws Exception {
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getImports( @Context UriInfo ui, @QueryParam( "ql" ) String query,  @QueryParam( "cursor" ) String cursor ) throws Exception {
 
         final Results importResults = importService.getImports( application.getId(), query, cursor );
 
@@ -161,13 +154,15 @@ public class ImportsResource extends AbstractContextResource {
         response.setParams( ui.getQueryParameters() );
         response.withResults( importResults );
 
-        return new JSONWithPadding( response );
+        return response;
     }
 
 
     @GET
     @Path( RootResource.ENTITY_ID_PATH )
-    public JSONWithPadding getImportById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getImportById( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
         throws Exception {
 
         final UUID importId = UUID.fromString( entityId.getPath() );
@@ -186,7 +181,7 @@ public class ImportsResource extends AbstractContextResource {
         response.setParams( ui.getQueryParameters() );
         response.setEntities( Collections.<Entity>singletonList( importEntity ) );
 
-        return new JSONWithPadding( response );
+        return response;
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
index 036c3fb..a4e3f40 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
@@ -17,42 +17,34 @@
 package org.apache.usergrid.rest.management.organizations.users;
 
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import java.util.LinkedHashMap;
-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.FormParam;
-import javax.ws.rs.GET;
-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.UriInfo;
-import static org.apache.commons.collections.MapUtils.getObject;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.management.exceptions.ManagementException;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
-import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
 import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
-import static org.apache.usergrid.utils.ConversionUtils.getBoolean;
-import static org.apache.usergrid.utils.ConversionUtils.string;
 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.UriInfo;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.apache.commons.collections.MapUtils.getObject;
+import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
+import static org.apache.usergrid.utils.ConversionUtils.getBoolean;
+import static org.apache.usergrid.utils.ConversionUtils.string;
+
 
 @Component("org.apache.usergrid.rest.management.organizations.users.UsersResource")
 @Scope("prototype")
@@ -79,7 +71,9 @@ public class UsersResource extends AbstractContextResource {
 
     @RequireOrganizationAccess
     @GET
-    public JSONWithPadding getOrganizationUsers( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getOrganizationUsers( @Context UriInfo ui,
                                                  @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -88,14 +82,16 @@ public class UsersResource extends AbstractContextResource {
 
         List<UserInfo> users = management.getAdminUsersForOrganization( organization.getUuid() );
         response.setData( users );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
-    public JSONWithPadding newUserForOrganization( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newUserForOrganization( @Context UriInfo ui, Map<String, Object> json,
                                                    @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -112,7 +108,9 @@ public class UsersResource extends AbstractContextResource {
     @RequireOrganizationAccess
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public JSONWithPadding newUserForOrganizationFromForm( @Context UriInfo ui, @FormParam("username") String username,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newUserForOrganizationFromForm( @Context UriInfo ui, @FormParam("username") String username,
                                                            @FormParam("name") String name,
                                                            @FormParam("email") String email,
                                                            @FormParam("password") String password,
@@ -150,7 +148,7 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 	/*
@@ -177,7 +175,9 @@ public class UsersResource extends AbstractContextResource {
     @RequireOrganizationAccess
     @PUT
     @Path(RootResource.USER_ID_PATH)
-    public JSONWithPadding addUserToOrganization( @Context UriInfo ui, @PathParam("userId") String userIdStr,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addUserToOrganization( @Context UriInfo ui, @PathParam("userId") String userIdStr,
                                                   @QueryParam("callback") @DefaultValue("callback") String callback )
             throws Exception {
 
@@ -195,14 +195,16 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @PUT
     @Path(RootResource.EMAIL_PATH)
-    public JSONWithPadding addUserToOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addUserToOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
                                                          @QueryParam("callback") @DefaultValue("callback")
                                                          String callback ) throws Exception {
 
@@ -220,14 +222,16 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @PUT
     @Path("{username}")
-    public JSONWithPadding addUserToOrganizationByUsername( @Context UriInfo ui, @PathParam("username") String username,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addUserToOrganizationByUsername( @Context UriInfo ui, @PathParam("username") String username,
                                                             @QueryParam("callback") @DefaultValue("callback")
                                                             String callback ) throws Exception {
 
@@ -253,14 +257,14 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @DELETE
     @Path(RootResource.USER_ID_PATH)
-    public JSONWithPadding removeUserFromOrganizationByUserId( @Context UriInfo ui,
+    public ApiResponse removeUserFromOrganizationByUserId( @Context UriInfo ui,
                                                                @PathParam("userId") String userIdStr,
                                                                @QueryParam("callback") @DefaultValue("callback")
                                                                String callback ) throws Exception {
@@ -279,14 +283,16 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @DELETE
     @Path("{username}")
-    public JSONWithPadding removeUserFromOrganizationByUsername( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse removeUserFromOrganizationByUsername( @Context UriInfo ui,
                                                                  @PathParam("username") String username,
                                                                  @QueryParam("callback") @DefaultValue("callback")
                                                                  String callback ) throws Exception {
@@ -313,14 +319,16 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @DELETE
     @Path(RootResource.EMAIL_PATH)
-    public JSONWithPadding removeUserFromOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse removeUserFromOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
                                                               @QueryParam("callback") @DefaultValue("callback")
                                                               String callback ) throws Exception {
 
@@ -338,6 +346,6 @@ public class UsersResource extends AbstractContextResource {
         response.setData( result );
         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/management/users/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
index 7ea4eec..1741db6 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
@@ -17,44 +17,33 @@
 package org.apache.usergrid.rest.management.users;
 
 
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-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 net.tanesha.recaptcha.ReCaptchaImpl;
+import net.tanesha.recaptcha.ReCaptchaResponse;
 import org.apache.commons.lang.StringUtils;
-import org.apache.usergrid.rest.management.ManagementResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
 import org.apache.usergrid.management.ActivationState;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.exceptions.RedirectionException;
+import org.apache.usergrid.rest.management.ManagementResource;
 import org.apache.usergrid.rest.management.users.organizations.OrganizationsResource;
 import org.apache.usergrid.rest.security.annotations.RequireAdminUserAccess;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
 import org.apache.usergrid.security.tokens.exceptions.TokenException;
 import org.apache.usergrid.services.ServiceResults;
+import org.glassfish.jersey.server.mvc.Viewable;
+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 com.sun.jersey.api.view.Viewable;
-
-import net.tanesha.recaptcha.ReCaptchaImpl;
-import net.tanesha.recaptcha.ReCaptchaResponse;
+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.UUID;
 
 import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isServiceAdmin;
 import static org.apache.usergrid.utils.ConversionUtils.string;
@@ -102,7 +91,9 @@ public class UserResource extends AbstractContextResource {
 
 
     @PUT
-    public JSONWithPadding setUserInfo( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse setUserInfo( @Context UriInfo ui, Map<String, Object> json,
                                         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -124,13 +115,15 @@ public class UserResource extends AbstractContextResource {
         ApiResponse response = createApiResponse();
         response.setAction( "update user info" );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @PUT
     @Path( "password" )
-    public JSONWithPadding setUserPasswordPut( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse setUserPasswordPut( @Context UriInfo ui, Map<String, Object> json,
                                                @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -151,13 +144,15 @@ public class UserResource extends AbstractContextResource {
         ApiResponse response = createApiResponse();
         response.setAction( "set user password" );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @POST
     @Path( "password" )
-    public JSONWithPadding setUserPasswordPost( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse setUserPasswordPost( @Context UriInfo ui, Map<String, Object> json,
                                                 @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
         return setUserPasswordPut( ui, json, callback );
@@ -167,7 +162,9 @@ public class UserResource extends AbstractContextResource {
     @RequireAdminUserAccess
     @GET
     @Path( "feed" )
-    public JSONWithPadding getFeed( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getFeed( @Context UriInfo ui,
                                     @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -178,13 +175,15 @@ public class UserResource extends AbstractContextResource {
         response.setEntities( results.getEntities() );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireAdminUserAccess
     @GET
-    public JSONWithPadding getUserData( @Context UriInfo ui, @QueryParam( "ttl" ) long ttl,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getUserData( @Context UriInfo ui, @QueryParam( "ttl" ) long ttl,
                                         @QueryParam( "shallow" ) boolean shallow,
                                         @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
@@ -198,7 +197,7 @@ public class UserResource extends AbstractContextResource {
         response.setData( userOrganizationData );
         response.setSuccess();
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
@@ -387,7 +386,9 @@ public class UserResource extends AbstractContextResource {
 
     @GET
     @Path( "reactivate" )
-    public JSONWithPadding reactivate( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse reactivate( @Context UriInfo ui,
                                        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -406,13 +407,15 @@ public class UserResource extends AbstractContextResource {
         management.startAdminUserActivationFlow( user );
 
         response.setAction( "reactivate user" );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @POST
     @Path( "revoketokens" )
-    public JSONWithPadding revokeTokensPost( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse revokeTokensPost( @Context UriInfo ui,
                                              @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -425,13 +428,15 @@ public class UserResource extends AbstractContextResource {
         management.revokeAccessTokensForAdminUser( adminId );
 
         response.setAction( "revoked user tokens" );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @PUT
     @Path( "revoketokens" )
-    public JSONWithPadding revokeTokensPut( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse revokeTokensPut( @Context UriInfo ui,
                                             @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
         return revokeTokensPost( ui, callback );
@@ -440,7 +445,9 @@ public class UserResource extends AbstractContextResource {
 
     @POST
     @Path( "revoketoken" )
-    public JSONWithPadding revokeTokenPost( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse revokeTokenPost( @Context UriInfo ui,
                                             @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback,
                                             @QueryParam( "token" ) String token ) throws Exception {
 
@@ -454,13 +461,15 @@ public class UserResource extends AbstractContextResource {
         management.revokeAccessTokenForAdminUser( adminId, token );
 
         response.setAction( "revoked user tokens" );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @PUT
     @Path( "revoketoken" )
-    public JSONWithPadding revokeTokenPut( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse revokeTokenPut( @Context UriInfo ui,
                                            @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback,
                                            @QueryParam( "token" ) String token ) throws Exception {
         return revokeTokenPost( ui, callback, token );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
index 7165d08..6136139 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
@@ -17,14 +17,12 @@
 package org.apache.usergrid.rest.management.users;
 
 
-import com.sun.jersey.api.json.JSONWithPadding;
-import com.sun.jersey.api.view.Viewable;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
 import net.tanesha.recaptcha.ReCaptchaImpl;
 import net.tanesha.recaptcha.ReCaptchaResponse;
 import org.apache.commons.lang.StringUtils;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.management.exceptions.ManagementException;
-
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
@@ -32,6 +30,7 @@ import org.apache.usergrid.rest.exceptions.AuthErrorInfo;
 import org.apache.usergrid.rest.exceptions.RedirectionException;
 import org.apache.usergrid.rest.management.ManagementResource;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
+import org.glassfish.jersey.server.mvc.Viewable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
@@ -105,7 +104,9 @@ public class UsersResource extends AbstractContextResource {
 
     @POST
     @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
-    public JSONWithPadding createUser( @Context UriInfo ui, @FormParam( "username" ) String username,
+    @JSONP
+    @Produces( {MediaType.APPLICATION_JSON, "application/javascript" })
+    public ApiResponse createUser( @Context UriInfo ui, @FormParam( "username" ) String username,
                                        @FormParam( "name" ) String name, @FormParam( "email" ) String email,
                                        @FormParam( "password" ) String password,
                                        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
@@ -135,7 +136,7 @@ public class UsersResource extends AbstractContextResource {
             throw mappableSecurityException( AuthErrorInfo.BAD_CREDENTIALS_SYNTAX_ERROR );
         }
 
-        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/management/users/organizations/OrganizationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java
index 71eccbf..186ccd3 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java
@@ -17,38 +17,26 @@
 package org.apache.usergrid.rest.management.users.organizations;
 
 
-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.FormParam;
-import javax.ws.rs.GET;
-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.UriInfo;
-
-import org.apache.usergrid.rest.RootResource;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+import com.google.common.collect.BiMap;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.UserInfo;
 import org.apache.usergrid.management.exceptions.ManagementException;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
+import org.apache.usergrid.rest.RootResource;
 import org.apache.usergrid.rest.security.annotations.RequireAdminUserAccess;
 import org.apache.usergrid.rest.security.annotations.RequireOrganizationAccess;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
 
-import com.google.common.collect.BiMap;
-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.UUID;
 
 
 @Component( "org.apache.usergrid.rest.management.users.organizations.OrganizationsResource" )
@@ -74,7 +62,9 @@ public class OrganizationsResource extends AbstractContextResource {
 
     @RequireAdminUserAccess
     @GET
-    public JSONWithPadding getUserOrganizations( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse getUserOrganizations( @Context UriInfo ui,
                                                  @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
             throws Exception {
 
@@ -84,13 +74,15 @@ public class OrganizationsResource extends AbstractContextResource {
         BiMap<UUID, String> userOrganizations = SubjectUtils.getOrganizations();
         response.setData( userOrganizations.inverse() );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireAdminUserAccess
     @POST
-    public JSONWithPadding newOrganizationForUser( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newOrganizationForUser( @Context UriInfo ui, Map<String, Object> json,
                                                    @QueryParam( "callback" ) @DefaultValue( "callback" )
                                                    String callback ) throws Exception {
 
@@ -103,14 +95,16 @@ public class OrganizationsResource extends AbstractContextResource {
 
         management.activateOrganization( organization );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireAdminUserAccess
     @POST
     @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
-    public JSONWithPadding newOrganizationForUserFromForm( @Context UriInfo ui, Map<String, Object> json,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse newOrganizationForUserFromForm( @Context UriInfo ui, Map<String, Object> json,
                                                            @QueryParam( "callback" ) @DefaultValue( "callback" )
                                                            String callback,
                                                            @FormParam( "organization" ) String organizationName )
@@ -128,14 +122,16 @@ public class OrganizationsResource extends AbstractContextResource {
 
         management.activateOrganization( organization );
 
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @PUT
     @Path( "{organizationName}" )
-    public JSONWithPadding addUserToOrganizationByOrganizationName( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addUserToOrganizationByOrganizationName( @Context UriInfo ui,
                                                                     @PathParam( "organizationName" )
                                                                     String organizationName, @QueryParam( "callback" )
                                                                     @DefaultValue( "callback" ) String callback )
@@ -147,14 +143,16 @@ public class OrganizationsResource extends AbstractContextResource {
         OrganizationInfo organization = management.getOrganizationByName( organizationName );
         management.addAdminUserToOrganization( user, organization, true );
         response.setData( organization );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @PUT
     @Path(RootResource.ORGANIZATION_ID_PATH)
-    public JSONWithPadding addUserToOrganizationByOrganizationId( @Context UriInfo ui, @PathParam( "organizationId" )
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse addUserToOrganizationByOrganizationId( @Context UriInfo ui, @PathParam( "organizationId" )
     String organizationIdStr, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception {
 
         ApiResponse response = createApiResponse();
@@ -163,14 +161,16 @@ public class OrganizationsResource extends AbstractContextResource {
         OrganizationInfo organization = management.getOrganizationByUuid( UUID.fromString( organizationIdStr ) );
         management.addAdminUserToOrganization( user, organization, true );
         response.setData( organization );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @DELETE
     @Path( RootResource.ORGANIZATION_ID_PATH )
-    public JSONWithPadding removeUserFromOrganizationByOrganizationId( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse removeUserFromOrganizationByOrganizationId( @Context UriInfo ui,
                                                                        @PathParam( "organizationId" )
                                                                        String organizationIdStr,
                                                                        @QueryParam( "callback" )
@@ -183,14 +183,16 @@ public class OrganizationsResource extends AbstractContextResource {
         OrganizationInfo organization = management.getOrganizationByUuid( UUID.fromString( organizationIdStr ) );
         management.removeAdminUserFromOrganization( user.getUuid(), organization.getUuid() );
         response.setData( organization );
-        return new JSONWithPadding( response, callback );
+        return response;
     }
 
 
     @RequireOrganizationAccess
     @DELETE
     @Path( "{organizationName}" )
-    public JSONWithPadding removeUserFromOrganizationByOrganizationName( @Context UriInfo ui,
+    @JSONP
+    @Produces({"application/json", "application/javascript"})
+    public ApiResponse removeUserFromOrganizationByOrganizationName( @Context UriInfo ui,
                                                                          @PathParam( "organizationName" )
                                                                          String organizationName,
                                                                          @QueryParam( "callback" )
@@ -203,6 +205,6 @@ public class OrganizationsResource extends AbstractContextResource {
         management.removeAdminUserFromOrganization( user.getUuid(), organization.getUuid() );
         response.setData( organization );
 
-        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/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
index 5e1d1f7..6ac7366 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
@@ -19,22 +19,9 @@ package org.apache.usergrid.rest.organizations;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.BiMap;
-import com.sun.jersey.api.json.JSONWithPadding;
-import java.util.UUID;
-import java.util.regex.Pattern;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-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 org.apache.shiro.authz.UnauthorizedException;
 import org.apache.usergrid.exception.NotImplementedException;
 import org.apache.usergrid.management.OrganizationInfo;
-import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.RootResource;
 import org.apache.usergrid.rest.applications.ApplicationResource;
@@ -49,6 +36,12 @@ 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.UriInfo;
+import java.util.UUID;
+
 
 @Component("org.apache.usergrid.rest.organizations.OrganizationResource")
 @Scope("prototype")
@@ -106,7 +99,7 @@ public class OrganizationResource extends AbstractContextResource {
         }
 
         // don't look up app if request is a PUT because a PUT can be used to restore a deleted app
-        if ( !hc.getRequest().getMethod().equalsIgnoreCase("PUT") ) {
+        if ( httpServletRequest.getMethod().equalsIgnoreCase("PUT") ) {
 
             BiMap<UUID, String> apps = management.getApplicationsForOrganization(organizationId);
             if (apps.get(applicationId) == null) {
@@ -184,11 +177,8 @@ public class OrganizationResource extends AbstractContextResource {
 
     @DELETE
     @RequireOrganizationAccess
-    public JSONWithPadding executeDelete( @Context UriInfo ui,
-                                          @QueryParam("callback") @DefaultValue("callback") String callback )
-            throws Exception {
-
-
+    public void executeDelete(
+        @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
         throw new NotImplementedException( "Organization delete is not allowed yet" );
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/security/CrossOriginRequestFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/CrossOriginRequestFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/CrossOriginRequestFilter.java
index e975463..be6c3e9 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/CrossOriginRequestFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/CrossOriginRequestFilter.java
@@ -17,23 +17,21 @@
 package org.apache.usergrid.rest.security;
 
 
+import org.apache.usergrid.rest.utils.CORSUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.usergrid.rest.utils.CORSUtils;
 
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerResponse;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import java.io.IOException;
 
 
 public class CrossOriginRequestFilter implements ContainerResponseFilter {
-
     public static final Logger logger = LoggerFactory.getLogger( CrossOriginRequestFilter.class );
 
-
     @Override
-    public ContainerResponse filter( ContainerRequest request, ContainerResponse response ) {
-
-        return CORSUtils.allowAllOrigins( request, response );
+    public void filter(ContainerRequestContext request, ContainerResponseContext response) throws IOException {
+        CORSUtils.allowAllOrigins( request, response );
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
index 551c687..6e4fc1e 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
@@ -17,20 +17,6 @@
 package org.apache.usergrid.rest.security;
 
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.UriInfo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Component;
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.ManagementService;
 import org.apache.usergrid.persistence.EntityManager;
@@ -44,24 +30,32 @@ import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
 import org.apache.usergrid.rest.utils.PathingUtils;
 import org.apache.usergrid.security.shiro.utils.SubjectUtils;
 import org.apache.usergrid.services.ServiceManagerFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
 
-import com.sun.jersey.api.model.AbstractMethod;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
-import com.sun.jersey.spi.container.ResourceFilterFactory;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.DynamicFeature;
+import javax.ws.rs.container.ResourceInfo;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.FeatureContext;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriInfo;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Properties;
 
 import static org.apache.commons.lang.StringUtils.isNotEmpty;
 import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
-import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isPermittedAccessToApplication;
-import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isPermittedAccessToOrganization;
-import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isUser;
-import static org.apache.usergrid.security.shiro.utils.SubjectUtils.loginApplicationGuest;
+import static org.apache.usergrid.security.shiro.utils.SubjectUtils.*;
 
 
 @Component
-public class SecuredResourceFilterFactory implements ResourceFilterFactory {
+public class SecuredResourceFilterFactory implements DynamicFeature {
 
     private static final Logger logger = LoggerFactory.getLogger( SecuredResourceFilterFactory.class );
 
@@ -118,58 +112,45 @@ public class SecuredResourceFilterFactory implements ResourceFilterFactory {
 
 
     @Override
-    public List<ResourceFilter> create( AbstractMethod am ) {
+    public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) {
+        Method am = resourceInfo.getResourceMethod();
+
         if ( am.isAnnotationPresent( RequireApplicationAccess.class ) ) {
-            return Collections.<ResourceFilter>singletonList( new ApplicationFilter() );
+            featureContext.register( ApplicationFilter.class );
         }
         else if ( am.isAnnotationPresent( RequireOrganizationAccess.class ) ) {
-            return Collections.<ResourceFilter>singletonList( new OrganizationFilter() );
+            featureContext.register( OrganizationFilter.class );
         }
         else if ( am.isAnnotationPresent( RequireSystemAccess.class ) ) {
-            return Collections.<ResourceFilter>singletonList( new SystemFilter() );
+            featureContext.register( SystemFilter.class );
         }
         else if ( am.isAnnotationPresent( RequireAdminUserAccess.class ) ) {
-            return Collections.<ResourceFilter>singletonList( new AdminUserFilter() );
+            featureContext.register( AdminUserFilter.class );
         }
-        return null;
-    }
 
+    }
 
-    public abstract class AbstractFilter implements ResourceFilter, ContainerRequestFilter {
+    public abstract class AbstractFilter implements ContainerRequestFilter {
         public AbstractFilter() {
         }
 
-
         @Override
-        public ContainerRequestFilter getRequestFilter() {
-            return this;
-        }
-
-
-        @Override
-        public ContainerResponseFilter getResponseFilter() {
-            return null;
-        }
+        public void filter(ContainerRequestContext request) throws IOException {
 
-
-        @Override
-        public ContainerRequest filter( ContainerRequest request ) {
-            logger.debug( "Filtering {}", request.getRequestUri().toString() );
+            logger.debug( "Filtering {}", request.getUriInfo().getRequestUri().toString() );
 
             if ( request.getMethod().equalsIgnoreCase( "OPTIONS" ) ) {
                 logger.debug( "Skipping option request" );
-                return request;
             }
 
             MultivaluedMap<java.lang.String, java.lang.String> params = uriInfo.getPathParameters();
             logger.debug( "Params: {}", params.keySet() );
 
             authorize( request );
-            return request;
         }
 
 
-        public abstract void authorize( ContainerRequest request );
+        public abstract void authorize( ContainerRequestContext request );
 
 
         public Identifier getApplicationIdentifier() {
@@ -236,7 +217,7 @@ public class SecuredResourceFilterFactory implements ResourceFilterFactory {
 
 
         @Override
-        public void authorize( ContainerRequest request ) {
+        public void authorize( ContainerRequestContext request ) {
             logger.debug( "OrganizationFilter.authorize" );
 
             if ( !isPermittedAccessToOrganization( getOrganizationIdentifier() ) ) {
@@ -256,7 +237,7 @@ public class SecuredResourceFilterFactory implements ResourceFilterFactory {
 
 
         @Override
-        public void authorize( ContainerRequest request ) {
+        public void authorize( ContainerRequestContext request ) {
             logger.debug( "ApplicationFilter.authorize" );
             if ( SubjectUtils.isAnonymous() ) {
                 ApplicationInfo application = null;
@@ -296,21 +277,21 @@ public class SecuredResourceFilterFactory implements ResourceFilterFactory {
 
 
         @Override
-        public void authorize( ContainerRequest request ) {
+        public void authorize( ContainerRequestContext request ) {
             logger.debug( "SystemFilter.authorize" );
             try {
-                if ( !request.isUserInRole( "sysadmin" ) ) {
+                if ( !request.getSecurityContext().isUserInRole( "sysadmin" ) ) {
                     logger.debug( "You are not the system admin." );
                     throw mappableSecurityException( "unauthorized", "No system access authorized",
-                            SecurityException.REALM );
+                        SecurityException.REALM );
                 }
             }
             catch ( IllegalStateException e ) {
                 logger.debug( "This is an invalid state",e );
-                if ( ( request.getUserPrincipal() == null ) || !"sysadmin"
-                        .equals( request.getUserPrincipal().getName() ) ) {
+                if ( ( request.getSecurityContext().getUserPrincipal() == null ) || !"sysadmin"
+                    .equals( request.getSecurityContext().getUserPrincipal().getName() ) ) {
                     throw mappableSecurityException( "unauthorized", "No system access authorized",
-                            SecurityException.REALM );
+                        SecurityException.REALM );
                 }
             }
         }
@@ -323,7 +304,7 @@ public class SecuredResourceFilterFactory implements ResourceFilterFactory {
 
 
         @Override
-        public void authorize( ContainerRequest request ) {
+        public void authorize( ContainerRequestContext request ) {
             logger.debug( "AdminUserFilter.authorize" );
             if ( !isUser( getUserIdentifier() ) ) {
                 throw mappableSecurityException( "unauthorized", "No admin user access authorized" );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
index 5f03809..6bf825f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
@@ -17,18 +17,15 @@
 package org.apache.usergrid.rest.security.shiro.filters;
 
 
-import java.security.Principal;
-import java.util.Map;
-
-import javax.ws.rs.core.SecurityContext;
-
+import org.apache.shiro.codec.Base64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
-import org.apache.shiro.codec.Base64;
-
-import com.sun.jersey.spi.container.ContainerRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.SecurityContext;
+import java.security.Principal;
+import java.util.Map;
 
 
 @Component
@@ -43,15 +40,14 @@ public class BasicAuthSecurityFilter extends SecurityFilter {
 
 
     @Override
-    public ContainerRequest filter( ContainerRequest request ) {
+    public void filter( ContainerRequestContext request ) {
         Map<String, String> auth_types = getAuthTypes( request );
         if ( ( auth_types == null ) || !auth_types.containsKey( AUTH_BASIC_TYPE ) ) {
-            return request;
+            return;
         }
-
         String[] values = Base64.decodeToString( auth_types.get( AUTH_BASIC_TYPE ) ).split( ":" );
         if ( values.length < 2 ) {
-            return request;
+            return;
         }
         String name = values[0].toLowerCase();
         String password = values[1];
@@ -64,13 +60,9 @@ public class BasicAuthSecurityFilter extends SecurityFilter {
                 && sysadmin_login_allowed ) {
             request.setSecurityContext( new SysAdminRoleAuthenticator() );
             logger.info( "System administrator access allowed" );
-            return request;
         }
-
-        return request;
     }
 
-
     private static class SysAdminRoleAuthenticator implements SecurityContext {
 
         private final Principal principal;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/0578d987/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
index cdb7f50..c4ee3e7 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
@@ -17,18 +17,16 @@
 package org.apache.usergrid.rest.security.shiro.filters;
 
 
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.Context;
-
+import org.apache.shiro.subject.Subject;
+import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
+import org.apache.usergrid.security.shiro.utils.SubjectUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
-import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
-import org.apache.usergrid.security.shiro.utils.SubjectUtils;
-
-import org.apache.shiro.subject.Subject;
 
-import com.sun.jersey.spi.container.ContainerRequest;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
 
 import static org.apache.commons.lang.StringUtils.isNotBlank;
 import static org.apache.usergrid.rest.exceptions.AuthErrorInfo.OAUTH2_INVALID_CLIENT;
@@ -50,7 +48,7 @@ public class ClientCredentialsSecurityFilter extends SecurityFilter {
 
 
     @Override
-    public ContainerRequest filter( ContainerRequest request ) {
+    public void filter( ContainerRequestContext request ) {
         String clientId = httpServletRequest.getParameter( "client_id" );
         String clientSecret = httpServletRequest.getParameter( "client_secret" );
 
@@ -65,6 +63,5 @@ public class ClientCredentialsSecurityFilter extends SecurityFilter {
                 throw mappableSecurityException( OAUTH2_INVALID_CLIENT );
             }
         }
-        return request;
     }
 }


Mime
View raw message