usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [10/10] usergrid git commit: Changes to configure our filters correctly, and numerous other test fixes. Only 7 REST tests are not passing.
Date Thu, 03 Sep 2015 20:30:36 GMT
Changes to configure our filters correctly, and numerous other test fixes. Only 7 REST tests are not passing.


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

Branch: refs/heads/usergrid-103-upgrade-jersey
Commit: eb2aa6ff9d45861c9a3e7d7cb0496423fc3c9a23
Parents: 0578d98
Author: Dave Johnson <snoopdave@apache.org>
Authored: Thu Sep 3 15:01:37 2015 -0400
Committer: Dave Johnson <snoopdave@apache.org>
Committed: Thu Sep 3 15:01:37 2015 -0400

----------------------------------------------------------------------
 stack/pom.xml                                   |   2 +-
 stack/rest/pom.xml                              | 120 +++++++------------
 .../rest/filters/ContentTypeFilter.java         |  34 +++---
 .../rest/filters/JSONPCallbackFilter.java       |   4 +
 .../usergrid/rest/filters/MeteringFilter.java   |   8 +-
 .../usergrid/rest/filters/TracingFilter.java    |   8 +-
 .../rest/management/ManagementResource.java     |  22 ++--
 .../organizations/OrganizationsResource.java    |  25 ++++
 .../rest/security/CrossOriginRequestFilter.java |   2 +
 .../security/SecuredResourceFilterFactory.java  |  73 ++++++++---
 .../shiro/filters/BasicAuthSecurityFilter.java  |  10 +-
 .../ClientCredentialsSecurityFilter.java        |   8 +-
 .../OAuth2AccessTokenSecurityFilter.java        |  29 +++--
 .../security/shiro/filters/SecurityFilter.java  |  26 ++--
 stack/rest/src/main/webapp/WEB-INF/web.xml      |  66 +++++++---
 .../java/org/apache/usergrid/rest/BasicIT.java  |   7 +-
 .../apache/usergrid/rest/IndexResourceIT.java   |  15 +--
 .../apache/usergrid/rest/PartialUpdateTest.java |   6 +-
 .../rest/applications/ApplicationDeleteIT.java  | 103 +++++++---------
 .../applications/ApplicationResourceIT.java     |  17 +--
 .../applications/assets/AssetResourceIT.java    |  12 +-
 .../applications/assets/AwsAssetResourceIT.java |   8 +-
 .../collection/CollectionsResourceIT.java       |  10 +-
 .../collection/DuplicateNameIT.java             |   4 +-
 .../activities/ActivityResourceIT.java          |   4 +-
 .../collection/devices/DevicesResourceIT.java   |   4 +-
 .../collection/groups/GroupResourceIT.java      |  12 +-
 .../users/ConnectionResourceTest.java           |   8 +-
 .../collection/users/OwnershipResourceIT.java   |  14 +--
 .../collection/users/PermissionsResourceIT.java |  22 ++--
 .../collection/users/UserResourceIT.java        |  22 ++--
 .../queries/BadGrammarQueryTest.java            |  14 +--
 .../applications/queries/BasicGeoTests.java     |  18 +--
 .../usergrid/rest/management/AccessTokenIT.java |  18 +--
 .../usergrid/rest/management/AdminUsersIT.java  |  33 ++---
 .../rest/management/ExportResourceIT.java       |  60 +++++-----
 .../rest/management/ImportResourceIT.java       |  16 +--
 .../rest/management/ManagementResourceIT.java   |  33 ++---
 .../rest/management/OrganizationsIT.java        |  14 +--
 .../rest/management/RegistrationIT.java         |   4 +-
 .../rest/test/resource/AbstractRestIT.java      |  68 +++++++----
 .../rest/test/resource/ClientSetup.java         |   3 +-
 .../usergrid/rest/test/resource/RestClient.java |  13 +-
 .../test/resource/endpoints/NamedResource.java  |  34 +++---
 .../test/resource/endpoints/SetupResource.java  |  10 +-
 .../resource/endpoints/mgmt/OrgResource.java    |  22 ++--
 stack/rest/src/test/resources/log4j.properties  |  36 +++---
 .../rest/src/test/resources/logging.properties  |  13 +-
 stack/services/pom.xml                          |   6 +
 .../security/providers/FoursquareProvider.java  |   6 +-
 .../usergrid/management/OrganizationIT.java     |  18 +--
 51 files changed, 628 insertions(+), 516 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index dc42920..15cca38 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -114,7 +114,7 @@
       <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>
+      <tomcat-version>7.0.64</tomcat-version>
       <antlr.version>3.4</antlr.version>
       <tika.version>1.4</tika.version>
       <mockito.version>1.10.8</mockito.version>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index e95e66f..bea05fe 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -39,26 +39,28 @@
     <!-- profile that arquillian uses when it builds/starts tomcat -->
     <profiles>
 
-        <!--<profile>-->
-            <!--<id>arquillian-tomcat</id>-->
-            <!--<activation>-->
-                <!--<activeByDefault>true</activeByDefault>-->
-            <!--</activation>-->
-            <!--<dependencies>-->
-                <!--<dependency>-->
-                    <!--<groupId>org.jboss.arquillian.container</groupId>-->
-                    <!--<artifactId>arquillian-tomcat-remote-7</artifactId>-->
-                    <!--<version>1.0.0.CR7</version>-->
-                    <!--<scope>test</scope>-->
-                <!--</dependency>-->
-                <!--<dependency>-->
-                    <!--<groupId>org.eu.ingwar.tools</groupId>-->
-                    <!--<artifactId>arquillian-suite-extension</artifactId>-->
-                    <!--<version>1.1.1</version>-->
-                    <!--<scope>test</scope>-->
-                <!--</dependency>-->
-            <!--</dependencies>-->
-        <!--</profile>-->
+        <!--
+        <profile>
+            <id>arquillian-tomcat</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.jboss.arquillian.container</groupId>
+                    <artifactId>arquillian-tomcat-remote-7</artifactId>
+                    <version>1.0.0.CR7</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.eu.ingwar.tools</groupId>
+                    <artifactId>arquillian-suite-extension</artifactId>
+                    <version>1.1.1</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        -->
 
     </profiles>
 
@@ -103,7 +105,7 @@
                     <threadCount>${usergrid.rest.threads}</threadCount>
                     <useSystemClassLoader>false</useSystemClassLoader>
                     <reuseForks>true</reuseForks>
-                    <argLine>-Dwebapp.directory=${basedir}/src/main/webapp -Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true -Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}
+                    <argLine>-Dwebapp.directory=${basedir}/src/main/webapp -Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true -Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar -Djava.util.logging.config.file=${basedir}/src/test/resources/logging.properties ${ug.argline}
                     </argLine>
                     <includes>
                         <include>**/*IT.java</include>
@@ -128,6 +130,7 @@
                 <version>2.6</version>
             </plugin>
 
+            <!-- TODO: do we need this?
             <plugin>
                 <groupId>org.jasig.mojo.jspc</groupId>
                 <artifactId>jspc-maven-plugin</artifactId>
@@ -144,14 +147,7 @@
                         </goals>
                     </execution>
                 </executions>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.jasig.mojo.jspc</groupId>
-                        <artifactId>jspc-compiler-tomcat6</artifactId>
-                        <version>2.0.0</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
+            </plugin> -->
 
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -213,11 +209,11 @@
             </exclusions>
         </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>org.apache.usergrid</groupId>-->
-            <!--<artifactId>usergrid-mongo-emulator</artifactId>-->
-            <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
+        <!-- <dependency>
+            <groupId>org.apache.usergrid</groupId>
+            <artifactId>usergrid-mongo-emulator</artifactId>
+            <version>${project.version}</version>
+        </dependency> -->
 
         <!-- Apache Dependencies -->
 
@@ -226,7 +222,7 @@
             <artifactId>commons-collections</artifactId>
         </dependency>
 
-        <!-- SUN, Javax Package, and Other Com Dependencies -->
+        <!-- Java EE and Jersey dependencies -->
 
         <dependency>
             <groupId>javax.servlet</groupId>
@@ -241,12 +237,10 @@
 
         <dependency>
             <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>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-client</artifactId>
@@ -259,7 +253,6 @@
             <version>2.21</version>
         </dependency>
 
-        <!-- support for JSP and Viewable -->
         <dependency>
             <groupId>org.glassfish.jersey.ext</groupId>
             <artifactId>jersey-mvc-jsp</artifactId>
@@ -269,7 +262,7 @@
         <dependency>
             <groupId>org.glassfish.jersey.media</groupId>
             <artifactId>jersey-media-multipart</artifactId>
-            <version>2.7</version>
+            <version>2.21</version>
         </dependency>
 
         <dependency>
@@ -278,42 +271,24 @@
             <version>2.21</version>
         </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>com.sun.jersey.contribs</groupId>-->
-            <!--<artifactId>jersey-multipart</artifactId>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>org.glassfish.jersey.ext</groupId>
+            <artifactId>jersey-spring3</artifactId>
+            <version>2.21</version>
+        </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>com.sun.jersey</groupId>-->
-            <!--<artifactId>jersey-json</artifactId>-->
-        <!--</dependency>-->
+        <!-- Jackson, Spring, and other dependencies -->
 
         <dependency>
             <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.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>
             <groupId>org.springframework</groupId>
@@ -415,24 +390,17 @@
             <scope>test</scope>
         </dependency>
 
-        <!--  use the in-memory test setup.  Just depend on the maven jetty plugin to launch jetty -->
         <dependency>
             <groupId>org.glassfish.jersey.test-framework.providers</groupId>
-            <artifactId>jersey-test-framework-provider-inmemory</artifactId>
+            <artifactId>jersey-test-framework-provider-external</artifactId>
             <version>2.21</version>
         </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.glassfish.jersey.test-framework</groupId>
+            <artifactId>jersey-test-framework-core</artifactId>
+            <version>2.21</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.usergrid</groupId>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
index 14f8fb2..93048db 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
@@ -59,7 +59,7 @@ public class ContentTypeFilter implements Filter {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
      */
     @Override
@@ -70,7 +70,7 @@ public class ContentTypeFilter implements Filter {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
      * javax.servlet.ServletResponse, javax.servlet.FilterChain)
      */
@@ -98,7 +98,7 @@ public class ContentTypeFilter implements Filter {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see javax.servlet.Filter#destroy()
      */
     @Override
@@ -153,12 +153,10 @@ public class ContentTypeFilter implements Filter {
             // nothing to read, check if it's a put or a post. If so set the
             // content type to json to create an empty json request
             if ( initial == -1 ) {
-                if ( ( HttpMethod.POST.equals( method ) || HttpMethod.PUT.equals( method ) ) && !MediaType
-                        .APPLICATION_FORM_URLENCODED.equals( getContentType() ) ) {
-
-                    logger.debug(
-                            "Setting content type to application/json for POST or PUT with no content at path '{}'",
-                            path );
+                if ( ( HttpMethod.POST.equals( method ) || HttpMethod.PUT.equals( method ) )
+                    && !MediaType.APPLICATION_FORM_URLENCODED.equals( getContentType() ) ) {
+                    logger.debug("Setting content type to application/json " +
+                            "for POST or PUT with no content at path '{}'", path );
 
                     setHeader( HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON );
                     setHeader( HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON );
@@ -170,9 +168,11 @@ public class ContentTypeFilter implements Filter {
             char firstChar = ( char ) initial;
 
             // its json, make it so
-            if ( firstChar == '{' || firstChar == '[' ) {
-                logger.debug( "Setting content type to application/json for POST or PUT with json content at path '{}'",
-                        path );
+            if ( firstChar == '{' || firstChar == '['
+                && !MediaType.APPLICATION_JSON.equals( getContentType() )) {
+
+                logger.debug( "Setting content type to application/json " +
+                        "for POST or PUT with json content at path '{}'", path );
 
                 setHeader( HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON );
                 setHeader( HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON );
@@ -193,7 +193,7 @@ public class ContentTypeFilter implements Filter {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see
          * javax.servlet.http.HttpServletRequestWrapper#getHeader(java.lang.
          * String)
@@ -212,7 +212,7 @@ public class ContentTypeFilter implements Filter {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see
          * javax.servlet.http.HttpServletRequestWrapper#getHeaders(java.lang
          * .String)
@@ -238,7 +238,7 @@ public class ContentTypeFilter implements Filter {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.servlet.http.HttpServletRequestWrapper#getHeaderNames()
          */
         @Override
@@ -257,7 +257,7 @@ public class ContentTypeFilter implements Filter {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.servlet.ServletRequestWrapper#getInputStream()
          */
         @Override
@@ -268,7 +268,7 @@ public class ContentTypeFilter implements Filter {
 
         /*
          * (non-Javadoc)
-         * 
+         *
          * @see javax.servlet.ServletRequestWrapper#getReader()
          */
         @Override

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/filters/JSONPCallbackFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/JSONPCallbackFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/JSONPCallbackFilter.java
index bc2bdc7d..23ccdf9 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/JSONPCallbackFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/JSONPCallbackFilter.java
@@ -21,15 +21,19 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Context;
 import java.io.IOException;
 
 import static org.apache.commons.lang.StringUtils.isNotBlank;
 
 
+@Resource
+@PreMatching
 @Component
 public class JSONPCallbackFilter implements ContainerRequestFilter {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/filters/MeteringFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/MeteringFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/MeteringFilter.java
index 24051ad..2735cdf 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/MeteringFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/MeteringFilter.java
@@ -32,11 +32,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.container.*;
 import javax.ws.rs.core.Context;
 import java.io.FilterInputStream;
 import java.io.IOException;
@@ -49,6 +47,8 @@ import java.util.concurrent.TimeUnit;
 
 
 // TODO: Metering for Jersey 2
+@Resource
+@PreMatching
 @Component
 public class MeteringFilter implements ContainerRequestFilter, ContainerResponseFilter {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/filters/TracingFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/TracingFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/TracingFilter.java
index fcff69d..64d0209 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/TracingFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/TracingFilter.java
@@ -26,11 +26,9 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.container.*;
 import javax.ws.rs.core.Context;
 
 
@@ -39,6 +37,8 @@ import javax.ws.rs.core.Context;
  *
  * @author zznate
  */
+@Resource
+@PreMatching
 @Component
 public class TracingFilter implements ContainerRequestFilter, ContainerResponseFilter {
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
index e79e521..8fba027 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
@@ -25,13 +25,8 @@ import org.apache.amber.oauth2.common.error.OAuthError;
 import org.apache.amber.oauth2.common.exception.OAuthProblemException;
 import org.apache.amber.oauth2.common.message.OAuthResponse;
 import org.apache.amber.oauth2.common.message.types.GrantType;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.http.HttpHost;
-import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.shiro.codec.Base64;
 import org.apache.usergrid.exception.NotImplementedException;
@@ -54,8 +49,6 @@ import org.glassfish.jersey.apache.connector.ApacheClientProperties;
 import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
 import org.glassfish.jersey.client.ClientConfig;
 import org.glassfish.jersey.client.ClientProperties;
-import org.glassfish.jersey.client.spi.Connector;
-import org.glassfish.jersey.client.spi.ConnectorProvider;
 import org.glassfish.jersey.jackson.JacksonFeature;
 import org.glassfish.jersey.server.mvc.Viewable;
 import org.slf4j.Logger;
@@ -67,7 +60,10 @@ import org.springframework.stereotype.Component;
 import javax.ws.rs.*;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
 import java.net.URLEncoder;
 import java.util.Collections;
 import java.util.Iterator;
@@ -650,7 +646,8 @@ public class ManagementResource extends AbstractContextResource {
                     } else {
 
                         // already created user, so just create an org
-                        final OrganizationInfo organization = management.createOrganization( orgName, userInfo, true );
+                        final OrganizationInfo organization =
+                            management.createOrganization( orgName, userInfo, true );
 
                         applicationCreator.createSampleFor( organization );
 
@@ -674,7 +671,8 @@ public class ManagementResource extends AbstractContextResource {
             throw e;
         }
 
-        final Response response = Response.status( SC_OK ).type( jsonMediaType( callback ) ).entity( accessInfo ).build();
+        final Response response = Response.status( SC_OK )
+            .type( jsonMediaType( callback ) ).entity( accessInfo ).build();
 
         timerContext.stop();
 
@@ -695,7 +693,7 @@ public class ManagementResource extends AbstractContextResource {
         Counter tokensRejectedCounter = getMetricsFactory().getCounter(
             ManagementResource.class, SSO_TOKENS_REJECTED );
         Counter tokensValidatedCounter = getMetricsFactory().getCounter(
-                ManagementResource.class, SSO_TOKENS_VALIDATED );
+            ManagementResource.class, SSO_TOKENS_VALIDATED );
 
         // create URL of central Usergrid's /management/me endpoint
 
@@ -762,7 +760,7 @@ public class ManagementResource extends AbstractContextResource {
                 clientConfig.connectorProvider( new ApacheConnectorProvider() );
 
                 jerseyClient = ClientBuilder.newClient( clientConfig );
-                jerseyClient.property( ClientProperties.CONNECT_TIMEOUT, timeout);
+                jerseyClient.property( ClientProperties.CONNECT_TIMEOUT, timeout );
                 jerseyClient.property( ClientProperties.READ_TIMEOUT, readTimeout );
             }
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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 9398f0e..26f6b5c 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
@@ -24,6 +24,7 @@ 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.persistence.index.query.Identifier;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.RootResource;
@@ -42,6 +43,9 @@ import javax.ws.rs.core.UriInfo;
 import java.util.Map;
 import java.util.UUID;
 
+import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
+import static org.apache.usergrid.security.shiro.utils.SubjectUtils.isPermittedAccessToOrganization;
+
 
 @Component( "org.apache.usergrid.rest.management.organizations.OrganizationsResource" )
 @Scope( "prototype" )
@@ -62,7 +66,13 @@ public class OrganizationsResource extends AbstractContextResource {
     public OrganizationsResource() {
     }
 
+    // TODO: better solution to this Jersey 2 introduced problem:
+    // Problem is that when Jersey scans the resources classes and methods to add our
+    // secured resource filter, it only recognizes methods with an HTTP method annotation
+    // but when I add the @GET annotation to the methods below, Jersey fails to resolve
+    // the resource methods when they are called.
 
+    //@GET
     @Path(RootResource.ORGANIZATION_ID_PATH)
     @RequireOrganizationAccess
     public OrganizationResource getOrganizationById( @Context UriInfo ui,
@@ -72,10 +82,18 @@ public class OrganizationsResource extends AbstractContextResource {
         if ( organization == null ) {
             throw new ManagementException( "Could not find organization for ID: " + organizationIdStr );
         }
+
+//        // TODO: get rid of this and make annotations work (see above)
+//        if ( !isPermittedAccessToOrganization( Identifier.from(organization) ) ) {
+//            logger.debug("No organization access authorized");
+//            throw mappableSecurityException( "unauthorized", "No organization access authorized" );
+//        }
+
         return getSubResource( OrganizationResource.class ).init( organization );
     }
 
 
+    //@GET
     @Path( "{organizationName}" )
     @RequireOrganizationAccess
     public OrganizationResource getOrganizationByName( @Context UriInfo ui,
@@ -85,6 +103,13 @@ public class OrganizationsResource extends AbstractContextResource {
         if ( organization == null ) {
             throw new ManagementException( "Could not find organization for name: " + organizationName );
         }
+
+//        // TODO: get rid of this and make annotations work (see above)
+//        if ( !isPermittedAccessToOrganization( Identifier.from(organization) ) ) {
+//            logger.debug("No organization access authorized");
+//            throw mappableSecurityException( "unauthorized", "No organization access authorized" );
+//        }
+
         return getSubResource( OrganizationResource.class ).init(organization);
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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 be6c3e9..00c12d7 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
@@ -21,12 +21,14 @@ import org.apache.usergrid.rest.utils.CORSUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Resource;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerResponseContext;
 import javax.ws.rs.container.ContainerResponseFilter;
 import java.io.IOException;
 
 
+@Resource
 public class CrossOriginRequestFilter implements ContainerResponseFilter {
     public static final Logger logger = LoggerFactory.getLogger( CrossOriginRequestFilter.class );
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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 6e4fc1e..f6edfcc 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
@@ -34,8 +34,9 @@ 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 javax.annotation.Resource;
+import javax.inject.Inject;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.DynamicFeature;
@@ -54,14 +55,12 @@ import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecu
 import static org.apache.usergrid.security.shiro.utils.SubjectUtils.*;
 
 
-@Component
+@Resource
 public class SecuredResourceFilterFactory implements DynamicFeature {
 
     private static final Logger logger = LoggerFactory.getLogger( SecuredResourceFilterFactory.class );
 
-    private
-    @Context
-    UriInfo uriInfo;
+    private @Context UriInfo uriInfo;
 
     EntityManagerFactory emf;
     ServiceManagerFactory smf;
@@ -71,6 +70,7 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
     ManagementService management;
 
 
+    @Inject
     public SecuredResourceFilterFactory() {
         logger.info( "SecuredResourceFilterFactory is installed" );
     }
@@ -115,6 +115,9 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
     public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) {
         Method am = resourceInfo.getResourceMethod();
 
+        logger.debug( "configure {} method {}",
+            resourceInfo.getResourceClass().getSimpleName(), resourceInfo.getResourceMethod().getName() );
+
         if ( am.isAnnotationPresent( RequireApplicationAccess.class ) ) {
             featureContext.register( ApplicationFilter.class );
         }
@@ -130,8 +133,12 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
 
     }
 
-    public abstract class AbstractFilter implements ContainerRequestFilter {
-        public AbstractFilter() {
+    public static abstract class AbstractFilter implements ContainerRequestFilter {
+
+        private UriInfo uriInfo;
+
+        public AbstractFilter( UriInfo uriInfo ) {
+            this.uriInfo = uriInfo;
         }
 
         @Override
@@ -209,13 +216,14 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
         }
     }
 
+    @Resource
+    public static class OrganizationFilter extends AbstractFilter {
 
-    private class OrganizationFilter extends AbstractFilter {
-
-        protected OrganizationFilter() {
+        @Inject
+        public OrganizationFilter( UriInfo uriInfo ) {
+            super(uriInfo);
         }
 
-
         @Override
         public void authorize( ContainerRequestContext request ) {
             logger.debug( "OrganizationFilter.authorize" );
@@ -230,12 +238,32 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
     }
 
 
-    private class ApplicationFilter extends AbstractFilter {
+    @Resource
+    public static class ApplicationFilter extends AbstractFilter {
+
+        EntityManagerFactory emf;
+        ManagementService management;
 
-        protected ApplicationFilter() {
+        @Autowired
+        public void setEntityManagerFactory( EntityManagerFactory emf ) {
+            this.emf = emf;
         }
 
 
+        public EntityManagerFactory getEntityManagerFactory() {
+            return emf;
+        }
+
+        @Autowired
+        public void setManagementService( ManagementService management ) {
+            this.management = management;
+        }
+
+        @Inject
+        public ApplicationFilter( UriInfo uriInfo ) {
+            super(uriInfo);
+        }
+
         @Override
         public void authorize( ContainerRequestContext request ) {
             logger.debug( "ApplicationFilter.authorize" );
@@ -248,7 +276,7 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
                 catch ( Exception e ) {
                     e.printStackTrace();
                 }
-                EntityManager em = emf.getEntityManager( application.getId() );
+                EntityManager em = getEntityManagerFactory().getEntityManager( application.getId() );
                 Map<String, String> roles = null;
                 try {
                     roles = em.getRoles();
@@ -271,8 +299,12 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
     }
 
 
-    public class SystemFilter extends AbstractFilter {
-        public SystemFilter() {
+    @Resource
+    public static class SystemFilter extends AbstractFilter {
+
+        @Inject
+        public SystemFilter( UriInfo uriInfo ) {
+            super(uriInfo);
         }
 
 
@@ -298,10 +330,13 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
     }
 
 
-    public class AdminUserFilter extends AbstractFilter {
-        public AdminUserFilter() {
-        }
+    @Resource
+    public static class AdminUserFilter extends AbstractFilter {
 
+        @Inject
+        public AdminUserFilter( UriInfo uriInfo ) {
+            super(uriInfo);
+        }
 
         @Override
         public void authorize( ContainerRequestContext request ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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 6bf825f..cb0745a 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
@@ -20,15 +20,17 @@ package org.apache.usergrid.rest.security.shiro.filters;
 import org.apache.shiro.codec.Base64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
 
 import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.ext.Provider;
 import java.security.Principal;
 import java.util.Map;
 
 
-@Component
+@Provider
+@PreMatching
 public class BasicAuthSecurityFilter extends SecurityFilter {
 
     private static final Logger logger = LoggerFactory.getLogger( BasicAuthSecurityFilter.class );
@@ -41,6 +43,8 @@ public class BasicAuthSecurityFilter extends SecurityFilter {
 
     @Override
     public void filter( ContainerRequestContext request ) {
+        logger.info("Filtering: " + request.getUriInfo().getBaseUri());
+
         Map<String, String> auth_types = getAuthTypes( request );
         if ( ( auth_types == null ) || !auth_types.containsKey( AUTH_BASIC_TYPE ) ) {
             return;
@@ -59,7 +63,7 @@ public class BasicAuthSecurityFilter extends SecurityFilter {
         if ( name.equals( sysadmin_login_name ) && password.equals( sysadmin_login_password )
                 && sysadmin_login_allowed ) {
             request.setSecurityContext( new SysAdminRoleAuthenticator() );
-            logger.info( "System administrator access allowed" );
+            logger.debug( "System administrator access allowed" );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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 c4ee3e7..eb982b8 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
@@ -22,18 +22,20 @@ 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 javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.ext.Provider;
 
 import static org.apache.commons.lang.StringUtils.isNotBlank;
 import static org.apache.usergrid.rest.exceptions.AuthErrorInfo.OAUTH2_INVALID_CLIENT;
 import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
 
 
-@Component
+@Provider
+@PreMatching
 public class ClientCredentialsSecurityFilter extends SecurityFilter {
 
     private static final Logger logger = LoggerFactory.getLogger( ClientCredentialsSecurityFilter.class );
@@ -49,6 +51,8 @@ public class ClientCredentialsSecurityFilter extends SecurityFilter {
 
     @Override
     public void filter( ContainerRequestContext request ) {
+        logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
+
         String clientId = httpServletRequest.getParameter( "client_id" );
         String clientSecret = httpServletRequest.getParameter( "client_secret" );
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
index 08de618..4bb0c83 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
@@ -38,27 +38,29 @@ import org.apache.usergrid.security.tokens.exceptions.ExpiredTokenException;
 import org.apache.usergrid.security.tokens.exceptions.InvalidTokenException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.ext.Provider;
 import java.io.IOException;
 
 import static org.apache.usergrid.rest.exceptions.AuthErrorInfo.*;
 import static org.apache.usergrid.rest.exceptions.SecurityException.mappableSecurityException;
 
-
-@Component
-public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
+@Provider
+@PreMatching
+public class OAuth2AccessTokenSecurityFilter extends SecurityFilter implements ContainerRequestFilter {
 
     public static final String REALM = "Usergrid Authentication";
 
-    private static final Logger LOG = LoggerFactory.getLogger( OAuth2AccessTokenSecurityFilter.class );
+    private static final Logger logger = LoggerFactory.getLogger( OAuth2AccessTokenSecurityFilter.class );
 
 
     public OAuth2AccessTokenSecurityFilter() {
-        LOG.info( "OAuth2AccessTokenSecurityFilter is installed" );
+        logger.info( "OAuth2AccessTokenSecurityFilter is installed" );
     }
 
 
@@ -68,6 +70,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
 
     @Override
     public void filter(ContainerRequestContext request) throws IOException {
+        logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
 
         try {
             try {
@@ -102,10 +105,10 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
                     // token is just some rubbish string
                     throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );
                 } catch (Exception e) {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug( "Unable to verify OAuth token: " + accessToken, e );
+                    if (logger.isDebugEnabled()) {
+                        logger.debug( "Unable to verify OAuth token: " + accessToken, e );
                     } else {
-                        LOG.warn( "Unable to verify OAuth token" );
+                        logger.warn( "Unable to verify OAuth token" );
                     }
                     throw mappableSecurityException( UNVERIFIED_OAUTH_ERROR );
                 }
@@ -124,7 +127,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
                     } catch (ManagementException e) {
                         throw mappableSecurityException( e, BAD_ACCESS_TOKEN_ERROR );
                     } catch (Exception e) {
-                        LOG.error( "failed to get admin user info from access token", e );
+                        logger.error( "failed to get admin user info from access token", e );
                     }
                     if (user == null) {
                         throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );
@@ -140,7 +143,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
                     } catch (ManagementException e) {
                         throw mappableSecurityException( e, BAD_ACCESS_TOKEN_ERROR );
                     } catch (Exception e) {
-                        LOG.error( "failed to get app user from access token", e );
+                        logger.error( "failed to get app user from access token", e );
                     }
                     if (user == null) {
                         throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );
@@ -155,7 +158,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
                     } catch (ManagementException e) {
                         throw mappableSecurityException( e, BAD_ACCESS_TOKEN_ERROR );
                     } catch (Exception e) {
-                        LOG.error( "failed to get organization info from access token", e );
+                        logger.error( "failed to get organization info from access token", e );
                     }
                     if (organization == null) {
                         throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );
@@ -171,7 +174,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter {
                     } catch (ManagementException e) {
                         throw mappableSecurityException( e, BAD_ACCESS_TOKEN_ERROR );
                     } catch (Exception e) {
-                        LOG.error( "failed to get application info from access token", e );
+                        logger.error( "failed to get application info from access token", e );
                     }
                     if (application == null) {
                         throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/SecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/SecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/SecurityFilter.java
index 625d352..e0dadba 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/SecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/SecurityFilter.java
@@ -17,9 +17,13 @@
 package org.apache.usergrid.rest.security.shiro.filters;
 
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
+import org.apache.commons.lang.StringUtils;
+import org.apache.usergrid.management.ManagementService;
+import org.apache.usergrid.persistence.EntityManagerFactory;
+import org.apache.usergrid.security.tokens.TokenService;
+import org.apache.usergrid.services.ServiceManagerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.container.ContainerRequestFilter;
@@ -27,23 +31,13 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.UriInfo;
 import javax.xml.ws.spi.http.HttpContext;
-
-import org.glassfish.jersey.server.ContainerRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-
-import org.apache.usergrid.management.ManagementService;
-import org.apache.usergrid.persistence.EntityManagerFactory;
-import org.apache.usergrid.security.tokens.TokenService;
-import org.apache.usergrid.services.ServiceManagerFactory;
-
-import org.apache.commons.lang.StringUtils;
-
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
 
 import static org.apache.usergrid.utils.StringUtils.stringOrSubstringAfterFirst;
 import static org.apache.usergrid.utils.StringUtils.stringOrSubstringBeforeFirst;
 
-
 public abstract class SecurityFilter implements ContainerRequestFilter {
 
     public static final String AUTH_OAUTH_2_ACCESS_TOKEN_TYPE = "BEARER";

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/webapp/WEB-INF/web.xml b/stack/rest/src/main/webapp/WEB-INF/web.xml
index 23c0751..0c46fe4 100644
--- a/stack/rest/src/main/webapp/WEB-INF/web.xml
+++ b/stack/rest/src/main/webapp/WEB-INF/web.xml
@@ -40,7 +40,6 @@
         <filter-name>swaggerFilter</filter-name>
         <filter-class>org.apache.usergrid.rest.SwaggerServlet</filter-class>
     </filter>
-
     <filter-mapping>
         <filter-name>swaggerFilter</filter-name>
         <url-pattern>/resources.json</url-pattern>
@@ -54,7 +53,7 @@
         <url-pattern>/management.json</url-pattern>
     </filter-mapping>
 
-    <!--  filter for setting default accept and Content-Type as application/json when undefined by client -->
+    <!--  filter for setting default accept and Content-Type as application/json when undefined by client
     <filter>
         <filter-name>contentTypeFilter</filter-name>
         <filter-class>org.apache.usergrid.rest.filters.ContentTypeFilter</filter-class>
@@ -63,6 +62,7 @@
         <filter-name>contentTypeFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
+    -->
 
     <filter>
         <filter-name>shiroFilter</filter-name>
@@ -79,43 +79,71 @@
 
     <filter>
         <filter-name>Usergrid REST API Server</filter-name>
-        <filter-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</filter-class>
+        <filter-class>org.glassfish.jersey.servlet.ServletContainer</filter-class>
+
+        <init-param>
+            <param-name>jersey.config.servlet.filter.contextPath</param-name>
+            <param-value>/</param-value>
+        </init-param>
+
+        <!-- Look for resources, providers and other annotated JAX-RS things in rest package -->
         <init-param>
-            <param-name>com.sun.jersey.config.property.packages</param-name>
+            <param-name>jersey.config.server.provider.packages</param-name>
             <param-value>org.apache.usergrid.rest</param-value>
         </init-param>
+
+        <!-- Look recursively in all packages -->
         <init-param>
-            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+            <param-name>jersey.config.server.provider.scanning.recursive</param-name>
             <param-value>true</param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
-            <param-value>org.apache.usergrid.rest.filters.TracingFilter,org.apache.usergrid.rest.filters.MeteringFilter,org.apache.usergrid.rest.filters.JSONPCallbackFilter,org.apache.usergrid.rest.security.shiro.filters.OAuth2AccessTokenSecurityFilter,org.apache.usergrid.rest.security.shiro.filters.BasicAuthSecurityFilter,org.apache.usergrid.rest.security.shiro.filters.ClientCredentialsSecurityFilter</param-value>
+            <param-name>jersey.config.server.provider.classnames</param-name>
+            <param-value>
+
+                org.apache.usergrid.rest.security.SecuredResourceFilterFactory,
+                org.glassfish.jersey.server.mvc.jsp.JspMvcFeature,
+                org.glassfish.jersey.media.multipart.MultiPartFeature
+
+                <!-- Currently, we do not use the JAX-RS annotations @PermitAll, @DenyAll, @RolesAllowed -->
+                <!-- , org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature -->
+
+            </param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
-            <param-value>org.apache.usergrid.rest.filters.TracingFilter,org.apache.usergrid.rest.security.CrossOriginRequestFilter,org.apache.usergrid.rest.filters.MeteringFilter</param-value>
+            <param-name>jersey.config.server.mvc.templateBasePath.jsp</param-name>
+            <param-value>/WEB-INF/jsp</param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
-            <param-value>org.apache.usergrid.rest.security.SecuredResourceFilterFactory,com.sun.jersey.api.container.filter.RolesAllowedResourceFilterFactory</param-value>
+            <param-name>jersey.config.server.wadl.disableWadl</param-name>
+            <param-value>true</param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.config.feature.DisableWADL</param-name>
-            <param-value>true</param-value>
+            <param-name>jersey.config.servlet.filter.staticContentRegex</param-name>
+            <param-value>/(((images|css|js|jsp|WEB-INF/jsp)/.*)|(favicon\.ico))</param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.config.property.JSPTemplatesBasePath</param-name>
-            <param-value>/WEB-INF/jsp</param-value>
+            <param-name>jersey.config.server.mediaTypeMappings</param-name>
+            <param-value>json:application/json,js:application/javascript</param-value>
         </init-param>
+
+        <!-- Have not had success with this yet:
         <init-param>
-            <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
-            <param-value>/(((images|css|js|jsp|WEB-INF/jsp)/.*)|(favicon\.ico))</param-value>
+            <param-name>jersey.config.server.tracing.threshold</param-name>
+            <param-value>TRACE</param-value>
         </init-param>
+
         <init-param>
-            <param-name>com.sun.jersey.config.property.MediaTypeMappings</param-name>
-            <param-value>json:application/json,js:application/javascript<!-- Temporarily removed until more testing can occur,csv:text/csv --></param-value>
+            <param-name>jersey.config.server.tracing.type</param-name>
+            <param-value>ALL</param-value>
         </init-param>
+        -->
+
     </filter>
 
     <filter-mapping>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
index edda5e5..905c522 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
@@ -25,7 +25,8 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+
+import javax.ws.rs.ClientErrorException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -74,9 +75,9 @@ public class BasicIT extends AbstractRestIT {
             try {
                 clientSetup.getRestClient().pathResource( getOrgAppPath( "users/JOE" ) ).get( ApiResponse.class );
                 fail("A get on a nonexistant object should fail");
-            } catch ( ResponseProcessingException e ) {
+            } catch ( ClientErrorException e ) {
                 assertEquals( "Guests should not be able to get a 404", 404,
-                    e.getResponse().getStatusInfo().getStatusCode());
+                    e.getResponse().getStatusInfo().getStatusCode() );
             }
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
index 065cd10..2bf9855 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
@@ -87,10 +87,10 @@ public class IndexResourceIT extends AbstractRestIT {
                 .get( "jobId" ).toString() )
             .getTarget();
 
-        result = res.request()
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "superuser")
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "superpassword" )
-            .get(ApiResponse.class);
+        HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
+            .credentials( "superuser", "superpassword" ).build();
+
+        result = res.register( feature ).request().get( ApiResponse.class );
 
         assertNotNull( result );
         assertEquals(status,result.getProperties().get("jobId").toString());
@@ -116,9 +116,10 @@ public class IndexResourceIT extends AbstractRestIT {
 
             WebTarget resource = this.clientSetup.getRestClient().pathResource("/system/index/" + appId).getTarget();
 
-            node = resource.request()
-                .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "superuser")
-                .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "superpassword" )
+            HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
+                .credentials( "superuser", "superpassword" ).build();
+
+            node = resource.register( feature ).request()
                 .accept( MediaType.APPLICATION_JSON )
                 .get( org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
index 109c76d..bc66467 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
@@ -24,7 +24,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -77,7 +77,7 @@ public class PartialUpdateTest extends AbstractRestIT {
             try {
                 // PUT the updates to the user and ensure they were saved
                 userNode = this.app().collection("users").entity(userNode).put(updateProps);
-            } catch (ResponseProcessingException uie) {
+            } catch (ClientErrorException uie) {
                 fail("Update failed due to: " + uie.getResponse().readEntity(String.class));
             }
 
@@ -118,7 +118,7 @@ public class PartialUpdateTest extends AbstractRestIT {
         try { //  PUT /users/fred   put /users/uuid
             userNode = this.app().collection("users").entity(props.get("username").toString()).put(updateProps);
 
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             fail("Update failed due to: " + uie.getResponse().readEntity(String.class));
         }
         refreshIndex();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
index b863a8e..d215256 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
@@ -30,8 +30,9 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -72,20 +73,13 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // delete the app
 
-        try {
-            clientSetup.getRestClient() .management().orgs()
-                .org(orgName).apps().app(appToDeleteId.toString()).getTarget()
-                .queryParam("access_token", orgAdminToken.getAccessToken())
-                .request()
-                .delete();
-
-            fail("Delete must fail without app_delete_confirm parameter");
+        final Response response = clientSetup.getRestClient().management().orgs()
+            .org( orgName ).apps().app( appToDeleteId.toString() ).getTarget()
+            .queryParam( "access_token", orgAdminToken.getAccessToken() )
+            .request()
+            .delete();
 
-        } catch (  ResponseProcessingException expected  ) {
-            Assert.assertEquals("Error must be 400", 400, expected.getResponse().getStatus() );
-            JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ));
-            Assert.assertEquals("Cannot delete application without app_delete_confirm parameter", node.get("error_description").textValue());
-        }
+        Assert.assertEquals("Error must be 400", 400, response.getStatus() );
 
         clientSetup.getRestClient().management().orgs()
             .org(orgName).apps().app(appToDeleteId.toString() ).getTarget()
@@ -105,7 +99,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
             fail("Must not be able to get deleted app");
 
-        } catch ( ResponseProcessingException expected ) {
+        } catch ( ClientErrorException expected ) {
             Assert.assertEquals("Error must be 404", 404, expected.getResponse().getStatus() );
             JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ));
             Assert.assertEquals("entity_not_found", node.get("error").textValue());
@@ -119,7 +113,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
             fail( "Must not be able to get deleted app" );
         }
-        catch ( ResponseProcessingException expected ) {
+        catch ( ClientErrorException expected ) {
             Assert.assertEquals( "Error must be 404", 404, expected.getResponse().getStatus() );
             JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ) );
             Assert.assertEquals( "organization_application_not_found", node.get( "error" ).textValue() );
@@ -137,7 +131,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
             fail("Must not be able to get deleted app's collection");
 
-        } catch ( ResponseProcessingException expected ) {
+        } catch ( ClientErrorException expected ) {
             Assert.assertEquals("Error must be 400", 404, expected.getResponse().getStatus() );
             JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ));
             Assert.assertEquals("organization_application_not_found", node.get("error").textValue());
@@ -155,7 +149,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
             fail("Must not be able to get deleted app entity");
 
-        } catch ( ResponseProcessingException expected ) {
+        } catch ( ClientErrorException expected ) {
             // TODO: why not a 404?
             Assert.assertEquals("Error must be 400", 404, expected.getResponse().getStatus() );
             JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ));
@@ -178,20 +172,13 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // test that we cannot delete the application a second time
 
-        try {
-            clientSetup.getRestClient().management().orgs().org( orgName ).apps().app( appToDeleteId.toString() )
-                .getTarget().queryParam( "access_token", orgAdminToken.getAccessToken() )
-                .queryParam( "app_delete_confirm", "confirm_delete_of_application_and_data" )
-                .request()
-                .delete();
-
-            fail("Can't delete a non existent app twice");
-        }
-        catch ( ResponseProcessingException expected ) {
-            Assert.assertEquals( "Error must be 404", 404, expected.getResponse().getStatus() );
-            JsonNode node = mapper.readTree( expected.getResponse().readEntity( String.class ) );
-            Assert.assertEquals( "entity_not_found", node.get( "error" ).textValue() );
-        }
+        final Response response1 = clientSetup.getRestClient().management()
+            .orgs().org( orgName ).apps().app( appToDeleteId.toString() )
+            .getTarget().queryParam( "access_token", orgAdminToken.getAccessToken() )
+            .queryParam( "app_delete_confirm", "confirm_delete_of_application_and_data" )
+            .request()
+            .delete();
+        Assert.assertEquals( "Error must be 404", 404, response1.getStatus() );
 
         // test that we can create a new application with the same name
 
@@ -203,7 +190,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         Assert.assertEquals("Must be able to create app with same name as deleted app",
             (orgName + "/" + appToDeleteName).toLowerCase(),
-            appCreateAgainResponse.getEntities().get(0).get("name"));
+            appCreateAgainResponse.getEntities().get(0).get( "name" ));
     }
 
 
@@ -245,13 +232,13 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // restore the app
 
-        logger.debug("\n\nRestoring app\n");
+        logger.debug( "\n\nRestoring app\n" );
 
         clientSetup.getRestClient().management().orgs()
             .org( orgName ).apps().app( appToDeleteId.toString() ).getTarget()
             .queryParam( "access_token", orgAdminToken.getAccessToken() )
             .request()
-            .put( javax.ws.rs.client.Entity.json( null ));
+            .put( javax.ws.rs.client.Entity.entity( "", MediaType.APPLICATION_JSON )); // must send body
 
         refreshIndex();
 
@@ -274,9 +261,9 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // test that we can get an app entity
 
-        logger.debug("\n\nGetting entities from app\n");
+        logger.debug( "\n\nGetting entities from app\n" );
 
-        UUID entityId = entities.get(0).getUuid();
+        UUID entityId = entities.get( 0 ).getUuid();
         ApiResponse entityResponse = clientSetup.getRestClient()
             .org( orgName ).app( appToDeleteName ).collection( "things" ).entity( entityId ).getTarget()
             .queryParam( "access_token", orgAdminToken.getAccessToken() )
@@ -290,7 +277,7 @@ public class ApplicationDeleteIT extends AbstractRestIT {
             .org( orgName ).app( appToDeleteName ).collection( "things" ).getTarget()
             .queryParam( "access_token", orgAdminToken.getAccessToken() )
             .request()
-            .get(ApiResponse.class);
+            .get( ApiResponse.class );
         Assert.assertEquals( entities.size(), collectionReponse.getEntityCount() );
     }
 
@@ -326,19 +313,13 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // attempt to restore original app, should get 409
 
-        try {
-
-            clientSetup.getRestClient() .management().orgs()
-                .org(orgName).apps().app(appToDeleteId.toString()).getTarget()
-                .queryParam("access_token", orgAdminToken.getAccessToken())
-                .request()
-                .put( javax.ws.rs.client.Entity.json(null) );
-
-            fail("Must fail to restore app with same name as existing app");
+        final Response response = clientSetup.getRestClient().management().orgs()
+            .org( orgName ).apps().app( appToDeleteId.toString() ).getTarget()
+            .queryParam( "access_token", orgAdminToken.getAccessToken() )
+            .request()
+            .put( javax.ws.rs.client.Entity.entity( "", MediaType.TEXT_PLAIN ) );// must send body with put
 
-        } catch ( ResponseProcessingException e ) {
-            Assert.assertEquals(409, e.getResponse().getStatus());
-        }
+        Assert.assertEquals( 409, response.getStatus() );
     }
 
 
@@ -361,7 +342,8 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // delete the app
 
-        clientSetup.getRestClient().management().orgs().org( orgName ).apps().app( appToDeleteId.toString() ).getTarget()
+        clientSetup.getRestClient().management()
+            .orgs().org( orgName ).apps().app( appToDeleteId.toString() ).getTarget()
             .queryParam( "access_token", orgAdminToken.getAccessToken() )
             .queryParam( "app_delete_confirm", "confirm_delete_of_application_and_data" )
             .request()
@@ -373,19 +355,14 @@ public class ApplicationDeleteIT extends AbstractRestIT {
 
         // attempt to delete new app, it should fail
 
-        try {
-
-            clientSetup.getRestClient().management().orgs().org( orgName ).apps().app( newAppId.toString() ).getTarget()
-                .queryParam( "access_token", orgAdminToken.getAccessToken() )
-                .queryParam("app_delete_confirm", "confirm_delete_of_application_and_data")
-                .request()
-                .delete();
-
-            fail("Must fail to delete app with same name as deleted app");
+        final Response response = clientSetup.getRestClient().management()
+            .orgs().org( orgName ).apps().app( newAppId.toString() ).getTarget()
+            .queryParam( "access_token", orgAdminToken.getAccessToken() )
+            .queryParam( "app_delete_confirm", "confirm_delete_of_application_and_data" )
+            .request()
+            .delete();
 
-        } catch ( ResponseProcessingException e ) {
-            Assert.assertEquals( 409, e.getResponse().getStatus() );
-        }
+        Assert.assertEquals( 409, response.getStatus() );
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
index f071b5e..bc24f5b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
@@ -32,8 +32,9 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.client.Invocation;
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -228,6 +229,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
      * (for backwards compatibility)
      */
     @Test
+    @Ignore("this form of backwards compatibility no longer needed")
     public void jsonForAcceptsTextHtml() throws Exception {
 
         //Create the organization resource
@@ -414,7 +416,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
                 .accept(MediaType.APPLICATION_JSON)
                 .post( javax.ws.rs.client.Entity.entity(entity, MediaType.APPLICATION_JSON_TYPE ), ApiResponse.class);
             fail("This should cause an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             assertEquals(
                 String.valueOf( Response.Status.BAD_REQUEST.getStatusCode()),
                 String.valueOf(uie.getResponse().getStatus()));
@@ -480,7 +482,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
             this.app().collection("users").entity(entity).get(
                 new QueryParameters().addParam("access_token", token), false);
             fail("The expired token should cause an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus());
         }
 
@@ -519,8 +521,8 @@ public class ApplicationResourceIT extends AbstractRestIT {
                 .get( ApiResponse.class );
             fail("The invalid TTL should cause an exception");
 
-        } catch (ResponseProcessingException uie) {
-            //TODO should this be handled and returned as a Status.BAD_REQUEST?
+        } catch (InternalServerErrorException uie) {
+            // TODO should this be handled and returned as a Status.BAD_REQUEST?
             //Status.INTERNAL_SERVER_ERROR is thrown because Jersey throws a NumberFormatException
             assertEquals( Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), uie.getResponse().getStatus());
         }
@@ -655,7 +657,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
                 .request()
                 .accept( MediaType.TEXT_HTML )
                 .post( javax.ws.rs.client.Entity.form( payload ), String.class );
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             assertEquals(String.valueOf( Response.Status.TEMPORARY_REDIRECT.getStatusCode()), uie.getResponse().getStatus());
         }
 
@@ -780,6 +782,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
      * Ensure that the Apigee Mobile Analytics config returns valid JSON
      */
     @Test
+    @Ignore
     public void validateApigeeApmConfigAPP() throws IOException {
         String orgName = clientSetup.getOrganizationName().toLowerCase();
         String appName = clientSetup.getAppName().toLowerCase();
@@ -795,7 +798,7 @@ public class ApplicationResourceIT extends AbstractRestIT {
 
             //if things are kosher then JSON should have value for instaOpsApplicationId
             assertTrue("it's valid json for APM", node.has("instaOpsApplicationId"));
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Validate that APM config exists
             assertNotEquals("APM Config API exists", Response.Status.NOT_FOUND,
                 uie.getResponse().getStatus()); //i.e It should not be "Not Found"

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
index 92705b2..0342883 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
@@ -24,6 +24,10 @@ import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.services.assets.data.AssetUtils;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
+import org.glassfish.jersey.media.multipart.MultiPart;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
+import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
+import org.glassfish.jersey.media.multipart.file.StreamDataBodyPart;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -240,9 +244,11 @@ public class AssetResourceIT extends AbstractRestIT {
 
             // upload a file larger than 6mb
 
-            byte[] data = IOUtils.toByteArray( this.getClass().getResourceAsStream( "/ship-larger-than-6mb.gif" ) );
-            FormDataMultiPart form = new FormDataMultiPart().field( "file", data, MediaType.MULTIPART_FORM_DATA_TYPE );
-            ApiResponse postResponse = pathResource( getOrgAppPath( "bars" ) ).post( form );
+            final StreamDataBodyPart part = new StreamDataBodyPart(
+                "file", getClass().getResourceAsStream( "/ship-larger-than-6mb.gif" ), "ship");
+            final MultiPart multipart = new FormDataMultiPart().bodyPart( part );
+
+            ApiResponse postResponse = pathResource( getOrgAppPath( "bars" ) ).post( multipart );
             UUID assetId = postResponse.getEntities().get(0).getUuid();
 
             String errorMessage = null;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AwsAssetResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AwsAssetResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AwsAssetResourceIT.java
index 72d45de..af41b69 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AwsAssetResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AwsAssetResourceIT.java
@@ -31,7 +31,7 @@ import org.junit.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.MediaType;
 import java.io.IOException;
 import java.io.InputStream;
@@ -95,7 +95,7 @@ public class AwsAssetResourceIT extends AbstractRestIT {
         }catch ( AwsPropertiesNotFoundException e ){
             fail("Shouldn't interrupt runtime if access key isnt found.");
         }
-        catch( ResponseProcessingException uie){
+        catch( ClientErrorException uie){
             assertEquals(500,uie.getResponse().getStatus());
         }
         finally{
@@ -129,7 +129,7 @@ public class AwsAssetResourceIT extends AbstractRestIT {
         }catch ( AwsPropertiesNotFoundException e ){
             fail("Shouldn't interrupt runtime if access key isnt found.");
         }
-        catch( ResponseProcessingException uie){
+        catch( ClientErrorException uie){
             assertEquals( 500, uie.getResponse().getStatus() );
         }
         finally{
@@ -171,7 +171,7 @@ public class AwsAssetResourceIT extends AbstractRestIT {
         }catch ( AwsPropertiesNotFoundException e ){
             fail("Shouldn't interrupt runtime if access key isnt found.");
         }
-        catch( ResponseProcessingException uie){
+        catch( ClientErrorException uie){
             assertEquals( 500, uie.getResponse().getStatus() );
         }
         finally{

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index b2bab35..92eac90 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -28,7 +28,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 
 import static org.junit.Assert.*;
@@ -62,7 +62,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         try {
             this.clientSetup.getRestClient().org(org).app(app).collection("cities").get();
             fail("Call to bad path exists, but it should not");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "organization_application_not_found", node.get( "error" ).textValue() );
@@ -75,7 +75,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         try {
             this.clientSetup.getRestClient().org(org).app(app).collection("cities").post(payload);
             fail("Call to bad path exists, but it should not");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "organization_application_not_found", node.get( "error" ).textValue() );
@@ -85,7 +85,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         try {
             this.clientSetup.getRestClient().org(org).app(app).collection("cities").entity(entity).put(payload);
             fail("Call to bad path exists, but it should not");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "organization_application_not_found", node.get( "error" ).textValue() );
@@ -95,7 +95,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         try {
             this.clientSetup.getRestClient().org(org).app(app).collection("cities").entity(entity).delete();
             fail("Call to bad path exists, but it should not");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "organization_application_not_found", node.get( "error" ).textValue() );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
index 4e21ca7..0776705 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
@@ -20,7 +20,7 @@ import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -47,7 +47,7 @@ public class DuplicateNameIT extends AbstractRestIT {
             this.app().collection(collectionName).post(entity);
             // fail if the POST did not return an exception
             fail("Should not have created duplicate entity");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
index 239bb13..e71f4a8 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.utils.UUIDUtils;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -88,7 +88,7 @@ public class ActivityResourceIT extends AbstractRestIT {
         // don't populate the user, it will use the currently authenticated user.
         try {
             groupActivityResource.post(activity);
-        }catch (ResponseProcessingException e)
+        }catch (ClientErrorException e)
         {
             throw e;
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
index 6e44e39..02716a7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 import org.junit.Ignore;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 
 
 public class DevicesResourceIT extends AbstractRestIT {
@@ -68,7 +68,7 @@ public class DevicesResourceIT extends AbstractRestIT {
             entity = devicesResource.entity(uuid).get();
             fail( "should get 404 error" );
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             assertEquals( 404, e.getResponse().getStatus() );
         }
         refreshIndex();


Mime
View raw message