knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject [2/2] knox git commit: [KNOX-675] - Upgrade Knox's Jetty dependency to latest 9.x
Date Thu, 03 Mar 2016 22:30:13 GMT
[KNOX-675] - Upgrade Knox's Jetty dependency to latest 9.x


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

Branch: refs/heads/master
Commit: 96e396223511980abefed2c6d47b1a0851247a5f
Parents: ea7efe7
Author: Kevin Minder <kminder@apache.org>
Authored: Thu Mar 3 17:29:53 2016 -0500
Committer: Kevin Minder <kminder@apache.org>
Committed: Thu Mar 3 17:29:53 2016 -0500

----------------------------------------------------------------------
 CHANGES                                         |   1 +
 .../ha/dispatch/DefaultHaDispatchTest.java      |   8 +-
 .../pom.xml                                     |   2 +-
 ...entityAsserterHttpServletRequestWrapper.java |   3 +-
 .../function/UsernameFunctionProcessorTest.java |  16 +-
 .../pom.xml                                     |   2 +-
 .../pom.xml                                     |   2 +-
 .../pom.xml                                     |   2 +-
 gateway-provider-jersey/pom.xml                 |   2 +-
 .../pom.xml                                     |   7 +-
 .../impl/ServiceRegistryFunctionsTest.java      |  20 +--
 gateway-provider-rewrite/pom.xml                |  14 +-
 .../rewrite/impl/UrlRewriteRequestStream.java   |   5 +-
 .../rewrite/impl/UrlRewriteResponseStream.java  |   4 +-
 .../UrlRewriteServletContextListenerTest.java   |  12 +-
 .../api/UrlRewriteServletFilterTest.java        |  81 +++++-----
 .../impl/FrontendFunctionProcessorTest.java     |  25 +--
 gateway-provider-security-authz-acls/pom.xml    |   6 -
 gateway-provider-security-hadoopauth/pom.xml    |   8 -
 gateway-provider-security-jwt/pom.xml           |   7 -
 gateway-provider-security-picketlink/pom.xml    |   8 -
 gateway-provider-security-preauth/pom.xml       |   7 -
 gateway-provider-security-shiro/pom.xml         |   8 -
 gateway-provider-security-webappsec/pom.xml     |   7 -
 gateway-server/pom.xml                          |  17 +-
 .../apache/hadoop/gateway/GatewayServer.java    | 106 ++++++++-----
 .../services/security/impl/JettySSLService.java |  29 ++--
 .../apache/hadoop/gateway/trace/TraceInput.java |   3 +-
 .../hadoop/gateway/trace/TraceOutput.java       |   3 +-
 .../hadoop/gateway/jetty/JettyHttpsTest.java    | 159 -------------------
 .../gateway/security/ShiroEmbeddedLdapTest.java |   2 +-
 .../hdfs/dispatch/WebHdfsHaDispatchTest.java    |   8 +-
 gateway-spi/pom.xml                             |   6 -
 .../gateway/services/security/SSLService.java   |   7 +-
 .../gateway/dispatch/DefaultDispatchTest.java   |   8 +-
 gateway-test-release/pom.xml                    |  20 +--
 gateway-test-utils/pom.xml                      |  13 +-
 .../org/apache/hadoop/test/log/NoOpLogger.java  |   4 +
 .../test/mock/MockHttpServletRequest.java       |  16 ++
 .../test/mock/MockHttpServletResponse.java      |   4 +
 .../org/apache/hadoop/test/mock/MockServer.java |   2 +-
 .../hadoop/test/mock/MockServletContext.java    |   5 +
 .../test/mock/MockServletInputStream.java       |   5 +-
 gateway-test/pom.xml                            |   2 +-
 gateway-util-common/pom.xml                     |   4 +
 .../SynchronousServletInputStreamAdapter.java   |  39 +++++
 .../SynchronousServletOutputStreamAdapter.java  |  34 ++++
 gateway-util-urltemplate/pom.xml                |   8 -
 pom.xml                                         |  22 +--
 49 files changed, 346 insertions(+), 437 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0179aea..daed19b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ Release Notes - Apache Knox - Version 0.9.0
     * [KNOX-674] - Expose Jetty's SSL cipher suite configuration via gateway-site.xml
 ** Improvement
     * [KNOX-677] - Upgrade to latest Groovy
+    * [KNOX-675] - Upgrade Knox's Jetty dependency to latest 9.x
 ** Bug
 
 ------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-ha/src/test/java/org/apache/hadoop/gateway/ha/dispatch/DefaultHaDispatchTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/test/java/org/apache/hadoop/gateway/ha/dispatch/DefaultHaDispatchTest.java b/gateway-provider-ha/src/test/java/org/apache/hadoop/gateway/ha/dispatch/DefaultHaDispatchTest.java
index 3cf13c6..0436532 100644
--- a/gateway-provider-ha/src/test/java/org/apache/hadoop/gateway/ha/dispatch/DefaultHaDispatchTest.java
+++ b/gateway-provider-ha/src/test/java/org/apache/hadoop/gateway/ha/dispatch/DefaultHaDispatchTest.java
@@ -22,6 +22,7 @@ import org.apache.hadoop.gateway.ha.provider.HaProvider;
 import org.apache.hadoop.gateway.ha.provider.HaServletContextListener;
 import org.apache.hadoop.gateway.ha.provider.impl.DefaultHaProvider;
 import org.apache.hadoop.gateway.ha.provider.impl.HaDescriptorFactory;
+import org.apache.hadoop.gateway.servlet.SynchronousServletOutputStreamAdapter;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -33,7 +34,6 @@ import org.junit.Test;
 
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletContext;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -74,10 +74,10 @@ public class DefaultHaDispatchTest {
     EasyMock.expect(inboundRequest.getAttribute("dispatch.ha.failover.counter")).andReturn(new AtomicInteger(1)).once();
 
     HttpServletResponse outboundResponse = EasyMock.createNiceMock(HttpServletResponse.class);
-    EasyMock.expect(outboundResponse.getOutputStream()).andAnswer( new IAnswer<ServletOutputStream>() {
+    EasyMock.expect(outboundResponse.getOutputStream()).andAnswer( new IAnswer<SynchronousServletOutputStreamAdapter>() {
       @Override
-      public ServletOutputStream answer() throws Throwable {
-        return new ServletOutputStream() {
+      public SynchronousServletOutputStreamAdapter answer() throws Throwable {
+        return new SynchronousServletOutputStreamAdapter() {
           @Override
           public void write( int b ) throws IOException {
             throw new IOException( "unreachable-host" );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-common/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/pom.xml b/gateway-provider-identity-assertion-common/pom.xml
index 4933d7b..e107e41 100644
--- a/gateway-provider-identity-assertion-common/pom.xml
+++ b/gateway-provider-identity-assertion-common/pom.xml
@@ -67,7 +67,7 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java b/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
index 257cadf..835a7a3 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
@@ -22,6 +22,7 @@ import org.apache.hadoop.gateway.SpiGatewayMessages;
 import org.apache.hadoop.gateway.config.GatewayConfig;
 import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
 import org.apache.hadoop.gateway.security.PrimaryPrincipal;
+import org.apache.hadoop.gateway.servlet.SynchronousServletInputStreamAdapter;
 import org.apache.hadoop.gateway.util.HttpUtils;
 
 import javax.servlet.ServletInputStream;
@@ -221,7 +222,7 @@ private static SpiGatewayMessages log = MessagesFactory.get( SpiGatewayMessages.
     return sb.toString();
   }
 
-  private class ServletInputStreamWrapper extends ServletInputStream {
+  private class ServletInputStreamWrapper extends SynchronousServletInputStreamAdapter {
 
     private InputStream stream;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-common/src/test/java/org/apache/hadoop/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/test/java/org/apache/hadoop/gateway/identityasserter/function/UsernameFunctionProcessorTest.java b/gateway-provider-identity-assertion-common/src/test/java/org/apache/hadoop/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
index 3cc81a8..73920e7 100644
--- a/gateway-provider-identity-assertion-common/src/test/java/org/apache/hadoop/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
+++ b/gateway-provider-identity-assertion-common/src/test/java/org/apache/hadoop/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
@@ -30,8 +30,8 @@ import org.apache.hadoop.test.mock.MockServlet;
 import org.apache.http.auth.BasicUserPrincipal;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.testing.HttpTester;
-import org.eclipse.jetty.testing.ServletTester;
+import org.eclipse.jetty.http.HttpTester;
+import org.eclipse.jetty.servlet.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.log.Log;
 import org.hamcrest.core.Is;
@@ -68,8 +68,8 @@ import static org.junit.Assert.fail;
 public class UsernameFunctionProcessorTest {
 
   private ServletTester server;
-  private HttpTester request;
-  private HttpTester response;
+  private HttpTester.Request request;
+  private HttpTester.Response response;
   private ArrayQueue<MockInteraction> interactions;
   private MockInteraction interaction;
 
@@ -108,8 +108,8 @@ public class UsernameFunctionProcessorTest {
     server.start();
 
     interaction = new MockInteraction();
-    request = new HttpTester();
-    response = new HttpTester();
+    request = HttpTester.newRequest();
+    response = null;
   }
 
   @After
@@ -190,10 +190,10 @@ public class UsernameFunctionProcessorTest {
     request.setURI( "/test-input-path?test-query-input-name=test-query-input-value" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "test-input-host:777" );
-    request.setContentType( "text/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
     request.setContent( input );
 
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), Is.is( 200 ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-concat/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-concat/pom.xml b/gateway-provider-identity-assertion-concat/pom.xml
index ba867a8..f88ec42 100644
--- a/gateway-provider-identity-assertion-concat/pom.xml
+++ b/gateway-provider-identity-assertion-concat/pom.xml
@@ -63,7 +63,7 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-pseudo/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-pseudo/pom.xml b/gateway-provider-identity-assertion-pseudo/pom.xml
index 64e9502..a2d78b9 100644
--- a/gateway-provider-identity-assertion-pseudo/pom.xml
+++ b/gateway-provider-identity-assertion-pseudo/pom.xml
@@ -63,7 +63,7 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-identity-assertion-regex/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-regex/pom.xml b/gateway-provider-identity-assertion-regex/pom.xml
index 3b183b2..34bce9b 100644
--- a/gateway-provider-identity-assertion-regex/pom.xml
+++ b/gateway-provider-identity-assertion-regex/pom.xml
@@ -63,7 +63,7 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-jersey/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-jersey/pom.xml b/gateway-provider-jersey/pom.xml
index b6eccf7..6416687 100644
--- a/gateway-provider-jersey/pom.xml
+++ b/gateway-provider-jersey/pom.xml
@@ -65,7 +65,7 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite-func-service-registry/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/pom.xml b/gateway-provider-rewrite-func-service-registry/pom.xml
index 52bbed5..262a1b1 100644
--- a/gateway-provider-rewrite-func-service-registry/pom.xml
+++ b/gateway-provider-rewrite-func-service-registry/pom.xml
@@ -75,12 +75,15 @@
             <artifactId>velocity</artifactId>
             <scope>test</scope>
         </dependency>
-
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.hamcrest</groupId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/hadoop/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/hadoop/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java b/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/hadoop/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
index 4f57f0f..01b62d6 100644
--- a/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/hadoop/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
+++ b/gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/hadoop/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
@@ -31,8 +31,8 @@ import org.apache.http.auth.BasicUserPrincipal;
 import org.easymock.EasyMock;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.testing.HttpTester;
-import org.eclipse.jetty.testing.ServletTester;
+import org.eclipse.jetty.http.HttpTester;
+import org.eclipse.jetty.servlet.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.log.Log;
 import org.hamcrest.core.Is;
@@ -57,8 +57,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
 public class ServiceRegistryFunctionsTest {
 
   private ServletTester server;
-  private HttpTester request;
-  private HttpTester response;
+  private HttpTester.Request request;
+  private HttpTester.Response response;
   private ArrayQueue<MockInteraction> interactions;
   private MockInteraction interaction;
 
@@ -108,8 +108,8 @@ public class ServiceRegistryFunctionsTest {
     server.start();
 
     interaction = new MockInteraction();
-    request = new HttpTester();
-    response = new HttpTester();
+    request = HttpTester.newRequest();
+    response = null;
   }
 
   @Test
@@ -135,10 +135,10 @@ public class ServiceRegistryFunctionsTest {
     request.setURI( "/test-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "test-host:42" );
-    request.setContentType( "text/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
     request.setContent( input );
 
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), Is.is( 200 ) );
@@ -167,10 +167,10 @@ public class ServiceRegistryFunctionsTest {
     request.setURI( "/test-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "test-host:42" );
-    request.setContentType( "application/json; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/json; charset=UTF-8" );
     request.setContent( input );
 
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), Is.is( 200 ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/pom.xml b/gateway-provider-rewrite/pom.xml
index 243969e..3d18327 100644
--- a/gateway-provider-rewrite/pom.xml
+++ b/gateway-provider-rewrite/pom.xml
@@ -59,14 +59,6 @@
             <groupId>${gateway-group}</groupId>
             <artifactId>gateway-spi</artifactId>
         </dependency>
-
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-digester3</artifactId>
@@ -104,9 +96,13 @@
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>test-jetty-servlet</artifactId>
+            <artifactId>jetty-servlet</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-util</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>org.hamcrest</groupId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequestStream.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequestStream.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequestStream.java
index 4fa3f26..1904d15 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequestStream.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteRequestStream.java
@@ -17,12 +17,13 @@
  */
 package org.apache.hadoop.gateway.filter.rewrite.impl;
 
-import javax.servlet.ServletInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.hadoop.gateway.servlet.SynchronousServletInputStreamAdapter;
+
 //TODO: This needs to be coded much more efficiently!
-public class UrlRewriteRequestStream extends ServletInputStream {
+public class UrlRewriteRequestStream extends SynchronousServletInputStreamAdapter {
 
   private InputStream stream;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteResponseStream.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteResponseStream.java b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteResponseStream.java
index 28e4458..30d3cc4 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteResponseStream.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/UrlRewriteResponseStream.java
@@ -18,15 +18,15 @@
 package org.apache.hadoop.gateway.filter.rewrite.impl;
 
 import org.apache.hadoop.gateway.filter.GatewayResponse;
+import org.apache.hadoop.gateway.servlet.SynchronousServletOutputStreamAdapter;
 
-import javax.servlet.ServletOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
 //TODO: This needs to be coded much more efficiently!
-public class UrlRewriteResponseStream extends ServletOutputStream {
+public class UrlRewriteResponseStream extends SynchronousServletOutputStreamAdapter {
 
   private static int DEFAULT_BUFFER_SIZE = 1024;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
index 452a633..09584e8 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
@@ -21,8 +21,8 @@ import org.apache.hadoop.test.mock.MockInteraction;
 import org.apache.hadoop.test.mock.MockServlet;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.testing.HttpTester;
-import org.eclipse.jetty.testing.ServletTester;
+import org.eclipse.jetty.http.HttpTester;
+import org.eclipse.jetty.servlet.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.junit.After;
 import org.junit.Before;
@@ -38,8 +38,8 @@ import static org.junit.Assert.fail;
 public class UrlRewriteServletContextListenerTest {
 
   private ServletTester server;
-  private HttpTester request;
-  private HttpTester response;
+  private HttpTester.Request request;
+  private HttpTester.Response response;
   private ArrayQueue<MockInteraction> interactions;
   private MockInteraction interaction;
 
@@ -73,8 +73,8 @@ public class UrlRewriteServletContextListenerTest {
     server.start();
 
     interaction = new MockInteraction();
-    request = new HttpTester();
-    response = new HttpTester();
+    request = HttpTester.newRequest();
+    response = null;
   }
 
   @After

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index d33582c..93bdac0 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -25,10 +25,11 @@ import org.apache.hadoop.test.log.NoOpLogger;
 import org.apache.hadoop.test.mock.MockInteraction;
 import org.apache.hadoop.test.mock.MockServlet;
 import org.apache.log4j.Appender;
+import org.eclipse.jetty.http.HttpHeader;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.testing.HttpTester;
-import org.eclipse.jetty.testing.ServletTester;
+import org.eclipse.jetty.http.HttpTester;
+import org.eclipse.jetty.servlet.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.log.Log;
 import org.junit.After;
@@ -62,8 +63,8 @@ import static org.xmlmatchers.transform.XmlConverters.the;
 public class UrlRewriteServletFilterTest {
 
   private ServletTester server;
-  private HttpTester request;
-  private HttpTester response;
+  private HttpTester.Request request;
+  private HttpTester.Response response;
   private ArrayQueue<MockInteraction> interactions;
   private MockInteraction interaction;
 
@@ -102,8 +103,8 @@ public class UrlRewriteServletFilterTest {
     server.start();
 
     interaction = new MockInteraction();
-    request = new HttpTester();
-    response = new HttpTester();
+    request = HttpTester.newRequest();
+    response = null;
   }
 
   @After
@@ -128,7 +129,7 @@ public class UrlRewriteServletFilterTest {
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -153,7 +154,7 @@ public class UrlRewriteServletFilterTest {
     request.setHeader( "Host", "mock-host:1" );
     request.setHeader( "Location", "http://mock-host:1/test-input-path" );
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -176,11 +177,11 @@ public class UrlRewriteServletFilterTest {
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 201 ) );
-    assertThat( response.getHeader( "Location" ), is( "http://mock-host:1/test-output-path-1" ) );
+    assertThat( response.get( HttpHeader.LOCATION ), is( "http://mock-host:1/test-output-path-1" ) );
   }
 
   @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
@@ -200,10 +201,10 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.addHeader( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
+    request.setHeader( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 201 ) );
@@ -229,11 +230,11 @@ public class UrlRewriteServletFilterTest {
     request.setHeader( "Host", "mock-host:1" );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
-    assertThat( response.getHeader( "Set-Cookie" ), is( "TODO" ) );
+    assertThat( response.get( HttpHeader.SET_COOKIE ), is( "TODO" ) );
     fail( "TODO" );
   }
 
@@ -256,11 +257,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.setContentType( "application/json; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/json; charset=UTF-8" );
     request.setContent( inputJson );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -288,11 +289,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.setContentType( "application/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/xml; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -321,7 +322,7 @@ public class UrlRewriteServletFilterTest {
     request.setHeader( "Host", "mock-host:1" );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -347,11 +348,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.setContentType( "application/html; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/html; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -376,11 +377,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.setContentType( "application/x-www-form-urlencoded; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -409,11 +410,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:42" );
-    request.setContentType( "text/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -444,11 +445,11 @@ public class UrlRewriteServletFilterTest {
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:42" );
     request.setHeader( "Location", "http://mock-host:42/test-input-path-1" );
-    request.setContentType( "text/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -484,11 +485,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:42" );
-    request.setContentType( "application/json; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/json; charset=UTF-8" );
     request.setContent( inputJson );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -517,11 +518,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:42" );
-    request.setContentType( "text/xml; charset=UTF-8" );
+    request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -553,11 +554,11 @@ public class UrlRewriteServletFilterTest {
       request.setURI( "/test-input-path" );
       request.setVersion( "HTTP/1.1" );
       request.setHeader( "Host", "mock-host:42" );
-      request.setContentType( "text/xml; charset=UTF-8" );
+      request.setHeader( "Content-Type", "text/xml; charset=UTF-8" );
       request.setContent( input );
 
       // Execute the request.
-      response.parse( server.getResponses( request.generate() ) );
+      response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
       // Test the results.
       assertThat( response.getStatus(), is( 500 ) );
@@ -588,11 +589,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:1" );
-    request.setContentType( "application/x-www-form-urlencoded; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8" );
     request.setContent( input );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );
@@ -622,11 +623,11 @@ public class UrlRewriteServletFilterTest {
     request.setHeader( "Host", "mock-host:42" );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 307 ) );
-    assertThat( response.getHeader( "Location" ), is( "http://mock-host:42/test-output-path-2" ) );
+    assertThat( response.get( HttpHeader.LOCATION ), is( "http://mock-host:42/test-output-path-2" ) );
 
     String actual = response.getContent();
 
@@ -663,11 +664,11 @@ public class UrlRewriteServletFilterTest {
     request.setURI( "/test-input-path" );
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "mock-host:42" );
-    request.setContentType( "application/json; charset=UTF-8" );
+    request.setHeader( "Content-Type", "application/json; charset=UTF-8" );
     request.setContent( responseJson );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     assertThat( response.getStatus(), is( 200 ) );
     JsonAssert.with( response.getContent() ).assertThat( "$.url", is( "http://mock-host:42/test-output-path-2" ) );
@@ -696,7 +697,7 @@ public class UrlRewriteServletFilterTest {
     request.setHeader( "Host", "mock-host:42" );
 
     // Execute the request.
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     // Test the results.
     assertThat( response.getStatus(), is( 200 ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
index 014ce4f..daf4101 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
@@ -35,8 +35,8 @@ import org.apache.http.auth.BasicUserPrincipal;
 import org.easymock.EasyMock;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.testing.HttpTester;
-import org.eclipse.jetty.testing.ServletTester;
+import org.eclipse.jetty.http.HttpTester;
+import org.eclipse.jetty.servlet.ServletTester;
 import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.Attributes;
 import org.eclipse.jetty.util.AttributesMap;
@@ -67,14 +67,15 @@ import java.util.ServiceLoader;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.anyOf;
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.fail;
 
 public class FrontendFunctionProcessorTest {
 
   private ServletTester server;
-  private HttpTester request;
-  private HttpTester response;
+  private HttpTester.Request request;
+  private HttpTester.Response response;
   private ArrayQueue<MockInteraction> interactions;
   private MockInteraction interaction;
 
@@ -165,8 +166,8 @@ public class FrontendFunctionProcessorTest {
     server.start();
 
     interaction = new MockInteraction();
-    request = new HttpTester();
-    response = new HttpTester();
+    request = HttpTester.newRequest();
+    response = null;
   }
 
   @Test
@@ -191,19 +192,19 @@ public class FrontendFunctionProcessorTest {
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "test-host:42" );
 
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     assertThat( response.getStatus(), Is.is( 200 ) );
 
     String json = response.getContent();
 
     // Note: The Jetty ServletTester/HttpTester doesn't return very good values.
-    JsonAssert.with( json ).assertThat( "$.url", is( "http://localhost:0" ) );
+    JsonAssert.with( json ).assertThat( "$.url", anyOf( is( "http://localhost:0" ), is( "http://0.0.0.0:0" ) ) );
     JsonAssert.with( json ).assertThat( "$.scheme", is( "http" ) );
-    JsonAssert.with( json ).assertThat( "$.host", is( "localhost" ) );
+    JsonAssert.with( json ).assertThat( "$.host", anyOf( is( "localhost" ), is( "0.0.0.0" ) ) );
     JsonAssert.with( json ).assertThat( "$.port", is( "0" ) );
-    JsonAssert.with( json ).assertThat( "$.addr", is( "localhost:0" ) );
-    JsonAssert.with( json ).assertThat( "$.address", is( "localhost:0" ) );
+    JsonAssert.with( json ).assertThat( "$.addr", anyOf( is( "localhost:0" ), is( "0.0.0.0:0" ) ) );
+    JsonAssert.with( json ).assertThat( "$.address", anyOf( is( "localhost:0" ), is( "0.0.0.0:0" ) ) );
     JsonAssert.with( json ).assertThat( "$.path", is( "" ) );
   }
 
@@ -236,7 +237,7 @@ public class FrontendFunctionProcessorTest {
     request.setVersion( "HTTP/1.1" );
     request.setHeader( "Host", "test-host:42" );
 
-    response.parse( server.getResponses( request.generate() ) );
+    response = HttpTester.parseResponse( server.getResponses( request.generate() ) );
 
     assertThat( response.getStatus(), Is.is( 200 ) );
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-authz-acls/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/pom.xml b/gateway-provider-security-authz-acls/pom.xml
index 1564144..c99178a 100644
--- a/gateway-provider-security-authz-acls/pom.xml
+++ b/gateway-provider-security-authz-acls/pom.xml
@@ -35,12 +35,6 @@
             <groupId>${gateway-group}</groupId>
             <artifactId>gateway-util-common</artifactId>
         </dependency>
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-hadoopauth/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-hadoopauth/pom.xml b/gateway-provider-security-hadoopauth/pom.xml
index 8240dde..deeeb55 100755
--- a/gateway-provider-security-hadoopauth/pom.xml
+++ b/gateway-provider-security-hadoopauth/pom.xml
@@ -44,14 +44,6 @@
             <groupId>${gateway-group}</groupId>
             <artifactId>gateway-util-common</artifactId>
         </dependency>
-
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-auth</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-jwt/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/pom.xml b/gateway-provider-security-jwt/pom.xml
index ef0727e..b87c003 100644
--- a/gateway-provider-security-jwt/pom.xml
+++ b/gateway-provider-security-jwt/pom.xml
@@ -46,13 +46,6 @@
             <artifactId>gateway-util-common</artifactId>
         </dependency>
 
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-picketlink/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-picketlink/pom.xml b/gateway-provider-security-picketlink/pom.xml
index b20e93c..27d168b 100644
--- a/gateway-provider-security-picketlink/pom.xml
+++ b/gateway-provider-security-picketlink/pom.xml
@@ -44,14 +44,6 @@
             <groupId>${gateway-group}</groupId>
             <artifactId>gateway-util-common</artifactId>
         </dependency>
-
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-        
         <dependency>
             <groupId>org.picketlink</groupId>
             <artifactId>picketlink-federation</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-preauth/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-preauth/pom.xml b/gateway-provider-security-preauth/pom.xml
index cabe506..a0924e7 100644
--- a/gateway-provider-security-preauth/pom.xml
+++ b/gateway-provider-security-preauth/pom.xml
@@ -45,13 +45,6 @@
             <artifactId>gateway-util-common</artifactId>
         </dependency>
 
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-shiro/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/pom.xml b/gateway-provider-security-shiro/pom.xml
index 763e9ce..a94bbfc 100644
--- a/gateway-provider-security-shiro/pom.xml
+++ b/gateway-provider-security-shiro/pom.xml
@@ -54,14 +54,6 @@
             <groupId>org.jboss.shrinkwrap.descriptors</groupId>
             <artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
         </dependency>
-
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>org.apache.shiro</groupId>
             <artifactId>shiro-web</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-provider-security-webappsec/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/pom.xml b/gateway-provider-security-webappsec/pom.xml
index 67c4b2d..db8aa3b 100644
--- a/gateway-provider-security-webappsec/pom.xml
+++ b/gateway-provider-security-webappsec/pom.xml
@@ -50,13 +50,6 @@
             <artifactId>cors-filter</artifactId>
         </dependency>
 
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-server/pom.xml b/gateway-server/pom.xml
index b3df024..20f22ae 100644
--- a/gateway-server/pom.xml
+++ b/gateway-server/pom.xml
@@ -58,19 +58,6 @@
 
     <dependencies>
 
-        <!--
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-        </dependency>
-        -->
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
@@ -123,6 +110,10 @@
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-webapp</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+        </dependency>
         <!--
         <dependency>
             <groupId>org.eclipse.jetty</groupId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
index a6943b6..12ab201 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
@@ -25,6 +25,9 @@ import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -75,11 +78,16 @@ import org.apache.hadoop.gateway.util.XmlUtils;
 import org.apache.log4j.PropertyConfigurator;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.NetworkConnector;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
 import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.handler.ContextHandlerCollection;
 import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
-import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
@@ -101,7 +109,6 @@ public class GatewayServer {
   private static Properties buildProperties;
 
   private Server jetty;
-  private ErrorHandler errorHandler;
   private GatewayConfig config;
   private ContextHandlerCollection contexts;
   private TopologyService monitor;
@@ -281,7 +288,7 @@ public class GatewayServer {
       services.start();
       DeploymentFactory.setGatewayServices(services);
       server.start();
-      log.startedGateway( server.jetty.getConnectors()[ 0 ].getLocalPort() );
+      log.startedGateway( server.jetty.getURI().getPort() );
       return server;
     }
   }
@@ -295,26 +302,33 @@ public class GatewayServer {
       this.listener = new InternalTopologyListener();
   }
 
-  private static Connector createConnector( final GatewayConfig config ) throws IOException {
-    Connector connector;
+  private static Connector createConnector( final Server server, final GatewayConfig config ) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException {
+    ServerConnector connector;
 
     // Determine the socket address and check availability.
     InetSocketAddress address = config.getGatewayAddress();
     checkAddressAvailability( address );
 
+    HttpConfiguration httpConfig = new HttpConfiguration();
+    httpConfig.setRequestHeaderSize( config.getHttpServerRequestHeaderBuffer() );
+    //httpConfig.setRequestBufferSize( config.getHttpServerRequestBuffer() );
+    httpConfig.setResponseHeaderSize( config.getHttpServerResponseHeaderBuffer() );
+    httpConfig.setOutputBufferSize( config.getHttpServerResponseBuffer() );
+
     if (config.isSSLEnabled()) {
+      HttpConfiguration httpsConfig = new HttpConfiguration( httpConfig );
+      httpsConfig.setSecureScheme( "https" );
+      httpsConfig.setSecurePort( address.getPort() );
+      httpsConfig.addCustomizer( new SecureRequestCustomizer() );
       SSLService ssl = services.getService("SSLService");
       String keystoreFileName = config.getGatewaySecurityDir() + File.separatorChar + "keystores" + File.separatorChar + "gateway.jks";
-      connector = (Connector) ssl.buildSSlConnector(keystoreFileName);
+      SslContextFactory sslContextFactory = (SslContextFactory)ssl.buildSslContextFactory( keystoreFileName );
+      connector = new ServerConnector( server, sslContextFactory, new HttpConnectionFactory( httpsConfig ) );
     } else {
-      connector = new SelectChannelConnector();
+      connector = new ServerConnector( server );
     }
     connector.setHost( address.getHostName() );
     connector.setPort( address.getPort() );
-    connector.setRequestHeaderSize( config.getHttpServerRequestHeaderBuffer() );
-    connector.setRequestBufferSize( config.getHttpServerRequestBuffer() );
-    connector.setResponseHeaderSize( config.getHttpServerResponseHeaderBuffer() );
-    connector.setResponseBufferSize( config.getHttpServerResponseBuffer() );
 
     return connector;
   }
@@ -341,20 +355,15 @@ public class GatewayServer {
   }
 
   private synchronized void start() throws Exception {
-    errorHandler = new ErrorHandler();
-    errorHandler.setShowStacks( false );
-    errorHandler.setTracedBodyFilter( System.getProperty( "org.apache.knox.gateway.trace.body.status.filter" ) );
-
     // Create the global context handler.
     contexts = new ContextHandlerCollection();
      // A map to keep track of current deployments by cluster name.
     deployments = new ConcurrentHashMap<String, WebAppContext>();
 
     // Start Jetty.
-    jetty = new Server();
-    jetty.addConnector( createConnector( config ) );
+    jetty = new Server( new QueuedThreadPool( config.getThreadPoolMax() ) );
+    jetty.addConnector( createConnector( jetty, config ) );
     jetty.setHandler( createHandlers( config, services, contexts ) );
-    jetty.setThreadPool( new QueuedThreadPool( config.getThreadPoolMax() ) );
 
     // Load the current topologies.
     File topologiesDir = calculateAbsoluteTopologiesDir();
@@ -387,10 +396,14 @@ public class GatewayServer {
     log.stoppedGateway();
   }
 
+  public URI getURI() {
+    return jetty.getURI();
+  }
+
   public InetSocketAddress[] getAddresses() {
     InetSocketAddress[] addresses = new InetSocketAddress[ jetty.getConnectors().length ];
     for( int i=0, n=addresses.length; i<n; i++ ) {
-      Connector connector = jetty.getConnectors()[ i ];
+      NetworkConnector connector = (NetworkConnector)jetty.getConnectors()[ i ];
       String host = connector.getHost();
       if( host == null ) {
         addresses[ i ] = new InetSocketAddress( connector.getLocalPort() );
@@ -401,6 +414,13 @@ public class GatewayServer {
     return addresses;
   }
 
+  private ErrorHandler createErrorHandler() {
+    ErrorHandler errorHandler = new ErrorHandler();
+    errorHandler.setShowStacks( false );
+    errorHandler.setTracedBodyFilter( System.getProperty( "org.apache.knox.gateway.trace.body.status.filter" ) );
+    return errorHandler;
+  }
+
   private WebAppContext createWebAppContext( Topology topology, File warFile, String warPath ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException {
     String topoName = topology.getName();
     WebAppContext context = new WebAppContext();
@@ -411,8 +431,8 @@ public class GatewayServer {
     context.setAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE, topoName );
     context.setAttribute( "org.apache.knox.gateway.frontend.uri", getFrontendUri( context, config ) );
     context.setAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE, config );
-    context.setTempDirectory( warFile );
-    context.setErrorHandler( errorHandler );
+    context.setTempDirectory( FileUtils.getFile( warFile, "META-INF", "temp" ) );
+    context.setErrorHandler( createErrorHandler() );
     return context;
   }
 
@@ -481,10 +501,11 @@ public class GatewayServer {
     if( !appDir.exists() ) {
       throw new DeploymentException( "Application archive does not exist: " + appDir.getAbsolutePath() );
     }
-    File warFile = new File( topoDir, Urls.encode( "/" + Urls.trimLeadingAndTrailingSlash( url ) ) );
-    File webInfDir = new File( warFile, "WEB-INF" );
-    explodeWar( appDir, warFile );
+    File warDir = new File( topoDir, Urls.encode( "/" + Urls.trimLeadingAndTrailingSlash( url ) ) );
+    File webInfDir = new File( warDir, "WEB-INF" );
+    explodeWar( appDir, warDir );
     mergeWebXmlOverrides( webInfDir );
+    createArchiveTempDir( warDir );
   }
 
   private synchronized void internalActivateTopology( Topology topology, File topoDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
@@ -499,20 +520,20 @@ public class GatewayServer {
 
   private synchronized void internalActivateArchive( Topology topology, File warDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
     log.activatingTopologyArchive( topology.getName(), warDir.getName() );
-    WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) );
-    WebAppContext oldContext = deployments.get( newContext.getContextPath() );
-    deployments.put( newContext.getContextPath(), newContext );
-    if( oldContext != null ) {
-      contexts.removeHandler( oldContext );
-    }
-    contexts.addHandler( newContext );
-    if( contexts.isRunning() ) {
-      try {
-        newContext.start();
-      } catch( Exception e ) {
-        auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE );
-        log.failedToDeployTopology( topology.getName(), e );
+    try {
+      WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) );
+      WebAppContext oldContext = deployments.get( newContext.getContextPath() );
+      deployments.put( newContext.getContextPath(), newContext );
+      if( oldContext != null ) {
+        contexts.removeHandler( oldContext );
       }
+      contexts.addHandler( newContext );
+      if( contexts.isRunning() && !newContext.isRunning() ) {
+          newContext.start();
+      }
+    } catch( Exception e ) {
+      auditor.audit( Action.DEPLOY, topology.getName(), ResourceType.TOPOLOGY, ActionOutcome.FAILURE );
+      log.failedToDeployTopology( topology.getName(), e );
     }
   }
 
@@ -632,6 +653,17 @@ public class GatewayServer {
 
   }
 
+  private File createArchiveTempDir( File warDir ) {
+    File tempDir = FileUtils.getFile( warDir, "META-INF", "temp" );
+    if( !tempDir.exists() ) {
+      tempDir.mkdirs();
+      if( !tempDir.exists() ) {
+        throw new DeploymentException( "Failed to create archive temporary directory: " + tempDir.getAbsolutePath() );
+      }
+    }
+    return tempDir;
+  }
+
   private static File calculateAbsoluteTopologiesDir( GatewayConfig config ) {
     File topoDir = new File( config.getGatewayTopologyDir() );
     topoDir = topoDir.getAbsoluteFile();

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/main/java/org/apache/hadoop/gateway/services/security/impl/JettySSLService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/security/impl/JettySSLService.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/security/impl/JettySSLService.java
index cb69509..3d73c36 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/security/impl/JettySSLService.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/security/impl/JettySSLService.java
@@ -17,7 +17,14 @@
  */
 package org.apache.hadoop.gateway.services.security.impl;
 
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
 import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
 import java.security.cert.CertificateExpiredException;
 import java.security.cert.CertificateNotYetValidException;
 import java.security.cert.X509Certificate;
@@ -37,8 +44,6 @@ import org.apache.hadoop.gateway.services.security.KeystoreServiceException;
 import org.apache.hadoop.gateway.services.security.MasterService;
 import org.apache.hadoop.gateway.services.security.SSLService;
 import org.apache.hadoop.gateway.util.X500PrincipalParser;
-import org.eclipse.jetty.server.ssl.SslConnector;
-import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 
 public class JettySSLService implements SSLService {
@@ -160,8 +165,8 @@ public class JettySSLService implements SSLService {
       throw new ServiceLifecycleException("Public certificate for the gateway is not of the expected type of X509Certificate. Something is wrong with the gateway keystore.");
     }
   }
-  
-  public Object buildSSlConnector( String keystoreFileName ) {
+
+  public Object buildSslContextFactory( String keystoreFileName ) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException {
     SslContextFactory sslContextFactory = new SslContextFactory( true );
     sslContextFactory.setCertAlias( "gateway-identity" );
     sslContextFactory.setKeyStoreType(keystoreType);
@@ -183,7 +188,7 @@ public class JettySSLService implements SSLService {
     String truststorePassword = null;
     if (clientAuthNeeded) {
       if (truststorePath != null) {
-        sslContextFactory.setTrustStore(truststorePath);
+        sslContextFactory.setTrustStore(loadKeyStore(keystoreFileName, keystoreType, master));
         char[] truststorePwd = null;
         try {
           truststorePwd = as.getPasswordFromAliasForGateway(GATEWAY_TRUSTSTORE_PASSWORD);
@@ -202,7 +207,7 @@ public class JettySSLService implements SSLService {
       else {
         // when clientAuthIsNeeded but no truststore provided
         // default to the server's keystore and details
-        sslContextFactory.setTrustStore(keystoreFileName);
+        sslContextFactory.setTrustStore(loadKeyStore(keystoreFileName, keystoreType, master));
         sslContextFactory.setTrustStorePassword(new String(master));
         sslContextFactory.setTrustStoreType(keystoreType);
       }
@@ -218,9 +223,7 @@ public class JettySSLService implements SSLService {
     if (sslExcludeProtocols != null && !sslExcludeProtocols.isEmpty()) {
       sslContextFactory.setExcludeProtocols( sslExcludeProtocols.toArray(new String[sslExcludeProtocols.size()]) );
     }
-    SslConnector sslConnector = new SslSelectChannelConnector( sslContextFactory );
-
-    return sslConnector;
+    return sslContextFactory;
   }
   
   @Override
@@ -234,4 +237,12 @@ public class JettySSLService implements SSLService {
     // TODO Auto-generated method stub
     
   }
+
+  private static KeyStore loadKeyStore( String fileName, String storeType, char[] storePass ) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException {
+    KeyStore keystore = KeyStore.getInstance(storeType);
+    InputStream is = new FileInputStream(fileName);
+    keystore.load( is, storePass );
+    return keystore;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceInput.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceInput.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceInput.java
index 3d10538..d6d7246 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceInput.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceInput.java
@@ -17,12 +17,13 @@
  */
 package org.apache.hadoop.gateway.trace;
 
+import org.apache.hadoop.gateway.servlet.SynchronousServletInputStreamAdapter;
 import org.apache.log4j.Logger;
 
 import javax.servlet.ServletInputStream;
 import java.io.IOException;
 
-class TraceInput extends ServletInputStream {
+class TraceInput extends SynchronousServletInputStreamAdapter {
 
   private static Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
   private static Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_BODY_LOGGER );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceOutput.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceOutput.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceOutput.java
index cec59b3..166753b 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceOutput.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/trace/TraceOutput.java
@@ -17,12 +17,13 @@
  */
 package org.apache.hadoop.gateway.trace;
 
+import org.apache.hadoop.gateway.servlet.SynchronousServletOutputStreamAdapter;
 import org.apache.log4j.Logger;
 
 import javax.servlet.ServletOutputStream;
 import java.io.IOException;
 
-class TraceOutput extends ServletOutputStream {
+class TraceOutput extends SynchronousServletOutputStreamAdapter {
 
   private static Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
   private static Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_BODY_LOGGER );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/test/java/org/apache/hadoop/gateway/jetty/JettyHttpsTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/jetty/JettyHttpsTest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/jetty/JettyHttpsTest.java
deleted file mode 100644
index 2223753..0000000
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/jetty/JettyHttpsTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.gateway.jetty;
-
-import org.apache.hadoop.test.category.ManualTests;
-import org.apache.hadoop.test.category.MediumTests;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.BasicClientConnectionManager;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ssl.SslConnector;
-import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.*;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-
-import static org.hamcrest.Matchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-@Category( { ManualTests.class, MediumTests.class } )
-public class JettyHttpsTest {
-
-  Logger log = LoggerFactory.getLogger( JettyHttpsTest.class );
-
-  private Server jetty;
-
-  @BeforeClass
-  public static void setupSuite() {
-    //System.setProperty( "java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol" );
-    //System.setProperty( "javax.net.debug", "ssl" );
-  }
-
-  @Before
-  public void setupTest() throws Exception {
-
-    SslContextFactory sslContext = new SslContextFactory( true );
-    sslContext.setCertAlias( "server" );
-    sslContext.setKeyStorePath( "target/test-classes/server-keystore.jks" );
-    sslContext.setKeyStorePassword( "horton" );
-    sslContext.setKeyManagerPassword( "horton" );
-    sslContext.setTrustStore( "target/test-classes/server-truststore.jks" );
-    sslContext.setTrustStorePassword( "horton" );
-    sslContext.setNeedClientAuth( false );
-    sslContext.setTrustAll( true );
-    SslConnector sslConnector = new SslSelectChannelConnector( sslContext );
-
-    ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
-    context.setContextPath( "/" );
-    ServletHolder servletHolder = new ServletHolder( new MockServlet() );
-    context.addServlet( servletHolder, "/*" );
-
-    jetty = new Server();
-    jetty.addConnector( sslConnector );
-    jetty.setHandler( context );
-    jetty.start();
-  }
-
-  @After
-  public void cleanupTest() throws Exception {
-    jetty.stop();
-    jetty.join();
-  }
-
-  @Test
-  public void testHttps() throws Exception {
-    int port = jetty.getConnectors()[ 0 ].getLocalPort();
-    String url = "https://localhost:" + port + "/";
-
-    System.out.println( "Jetty HTTPS listenting on port " + port + ". Press any key to continue." );
-    System.in.read();
-
-    SSLContext ctx = SSLContext.getInstance( "TLS" );
-    KeyManager[] keyManagers = createKeyManagers( "jks", "target/test-classes/client-keystore.jks", "horton" );
-    TrustManager[] trustManagers = createTrustManagers( "jks", "target/test-classes/client-truststore.jks", "horton" );
-    ctx.init( keyManagers, trustManagers, new SecureRandom() );
-
-    SSLSocketFactory socketFactory = new SSLSocketFactory( ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER );
-
-    SchemeRegistry schemes = new SchemeRegistry();
-    schemes.register( new Scheme( "https", port, socketFactory ) );
-    ClientConnectionManager cm = new BasicClientConnectionManager( schemes );
-
-    HttpClient client = new DefaultHttpClient( cm );
-
-    HttpGet get = new HttpGet( url );
-    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-    client.execute( get ).getEntity().writeTo( buffer );
-    assertThat( buffer.toString(), equalTo( "<html>Hello!</html>" ) );
-  }
-
-  private static KeyManager[] createKeyManagers( String keyStoreType, String keyStorePath, String keyStorePassword ) throws Exception {
-    KeyStore keyStore = loadKeyStore( keyStoreType, keyStorePath, keyStorePassword );
-    KeyManagerFactory kmf = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm() );
-    kmf.init( keyStore, keyStorePassword.toCharArray() );
-    return kmf.getKeyManagers();
-  }
-
-  private static TrustManager[] createTrustManagers( String trustStoreType, String trustStorePath, String trustStorePassword ) throws Exception {
-    KeyStore trustStore = loadKeyStore( trustStoreType, trustStorePath, trustStorePassword );
-    TrustManagerFactory tmf = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() );
-    tmf.init( trustStore );
-    return tmf.getTrustManagers();
-  }
-
-  private static KeyStore loadKeyStore( String type, String path, String password ) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException {
-    KeyStore keyStore = KeyStore.getInstance( type );
-    InputStream keystoreInput = new FileInputStream( path );
-    keyStore.load( keystoreInput, password.toCharArray() );
-    return keyStore;
-  }
-
-private static class MockServlet extends HttpServlet {
-  @Override
-  protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {
-    resp.setContentType( "text/html" );
-    resp.getWriter().write( "<html>Hello!</html>" );
-  }
-}
-
-}

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-server/src/test/java/org/apache/hadoop/gateway/security/ShiroEmbeddedLdapTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/security/ShiroEmbeddedLdapTest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/security/ShiroEmbeddedLdapTest.java
index 75744e5..aede0ad 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/security/ShiroEmbeddedLdapTest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/security/ShiroEmbeddedLdapTest.java
@@ -104,7 +104,7 @@ public class ShiroEmbeddedLdapTest {
 
   @Test
   public void testShiro() throws Exception {
-    String url = "http://localhost:" + jetty.getConnectors()[0].getPort() + "/";
+    String url = "http://localhost:" + jetty.getURI().getPort() + "/";
 
     given()
         .expect().statusCode( 401 )

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-service-webhdfs/src/test/java/org/apache/hadoop/gateway/hdfs/dispatch/WebHdfsHaDispatchTest.java
----------------------------------------------------------------------
diff --git a/gateway-service-webhdfs/src/test/java/org/apache/hadoop/gateway/hdfs/dispatch/WebHdfsHaDispatchTest.java b/gateway-service-webhdfs/src/test/java/org/apache/hadoop/gateway/hdfs/dispatch/WebHdfsHaDispatchTest.java
index 7e6dc1b..ed1eede 100644
--- a/gateway-service-webhdfs/src/test/java/org/apache/hadoop/gateway/hdfs/dispatch/WebHdfsHaDispatchTest.java
+++ b/gateway-service-webhdfs/src/test/java/org/apache/hadoop/gateway/hdfs/dispatch/WebHdfsHaDispatchTest.java
@@ -22,6 +22,7 @@ import org.apache.hadoop.gateway.ha.provider.HaProvider;
 import org.apache.hadoop.gateway.ha.provider.HaServletContextListener;
 import org.apache.hadoop.gateway.ha.provider.impl.DefaultHaProvider;
 import org.apache.hadoop.gateway.ha.provider.impl.HaDescriptorFactory;
+import org.apache.hadoop.gateway.servlet.SynchronousServletOutputStreamAdapter;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -33,7 +34,6 @@ import org.junit.Test;
 
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletContext;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -74,10 +74,10 @@ public class WebHdfsHaDispatchTest {
       EasyMock.expect(inboundRequest.getAttribute("dispatch.ha.failover.counter")).andReturn(new AtomicInteger(1)).once();
 
       HttpServletResponse outboundResponse = EasyMock.createNiceMock(HttpServletResponse.class);
-      EasyMock.expect(outboundResponse.getOutputStream()).andAnswer( new IAnswer<ServletOutputStream>() {
+      EasyMock.expect(outboundResponse.getOutputStream()).andAnswer( new IAnswer<SynchronousServletOutputStreamAdapter>() {
          @Override
-         public ServletOutputStream answer() throws Throwable {
-            return new ServletOutputStream() {
+         public SynchronousServletOutputStreamAdapter answer() throws Throwable {
+            return new SynchronousServletOutputStreamAdapter() {
                @Override
                public void write( int b ) throws IOException {
                   throw new IOException( "unreachable-host" );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-spi/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-spi/pom.xml b/gateway-spi/pom.xml
index 6c55072..196515e 100644
--- a/gateway-spi/pom.xml
+++ b/gateway-spi/pom.xml
@@ -59,12 +59,6 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-common</artifactId>
         </dependency>
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-        </dependency>
-        -->
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/SSLService.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/SSLService.java b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/SSLService.java
index 2863eff..d9ea6ed 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/SSLService.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/services/security/SSLService.java
@@ -17,8 +17,13 @@
  */
 package org.apache.hadoop.gateway.services.security;
 
+import java.io.IOException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+
 import org.apache.hadoop.gateway.services.Service;
 
 public interface SSLService extends Service {
-  public Object buildSSlConnector(String gatewayHomeDir);
+  Object buildSslContextFactory(String gatewayHomeDir) throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException;
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java b/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
index 1b06a8c..4c360ff 100644
--- a/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
+++ b/gateway-spi/src/test/java/org/apache/hadoop/gateway/dispatch/DefaultDispatchTest.java
@@ -34,11 +34,11 @@ import java.net.UnknownHostException;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.hadoop.gateway.config.GatewayConfig;
+import org.apache.hadoop.gateway.servlet.SynchronousServletOutputStreamAdapter;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -64,10 +64,10 @@ public class DefaultDispatchTest {
     HttpServletRequest inboundRequest = EasyMock.createNiceMock( HttpServletRequest.class );
 
     HttpServletResponse outboundResponse = EasyMock.createNiceMock( HttpServletResponse.class );
-    EasyMock.expect( outboundResponse.getOutputStream() ).andAnswer( new IAnswer<ServletOutputStream>() {
+    EasyMock.expect( outboundResponse.getOutputStream() ).andAnswer( new IAnswer<SynchronousServletOutputStreamAdapter>() {
       @Override
-      public ServletOutputStream answer() throws Throwable {
-        return new ServletOutputStream() {
+      public SynchronousServletOutputStreamAdapter answer() throws Throwable {
+        return new SynchronousServletOutputStreamAdapter() {
           @Override
           public void write( int b ) throws IOException {
             throw new IOException( "unreachable-host" );

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-release/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-test-release/pom.xml b/gateway-test-release/pom.xml
index a89b02c..18727bf 100644
--- a/gateway-test-release/pom.xml
+++ b/gateway-test-release/pom.xml
@@ -35,6 +35,11 @@
 
     <dependencies>
         <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-client</artifactId>
             <version>2.7.1</version>
@@ -123,7 +128,7 @@
         <dependency>
             <groupId>org.apache.knox</groupId>
             <artifactId>gateway-release</artifactId>
-            <version>0.9.0-SNAPSHOT</version>
+            <version>${gateway-version}</version>
             <exclusions>
                 <exclusion>
                     <groupId>org.apache.directory.server</groupId>
@@ -154,19 +159,6 @@
             </exclusions>
         </dependency>
         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-            <scope>provided</scope>
-        </dependency>
-         <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>3.0.1</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-test-utils/pom.xml b/gateway-test-utils/pom.xml
index 4dc2790..4283d62 100644
--- a/gateway-test-utils/pom.xml
+++ b/gateway-test-utils/pom.xml
@@ -50,6 +50,11 @@
     <dependencies>
 
         <dependency>
+            <groupId>${gateway-group}</groupId>
+            <artifactId>gateway-util-common</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>hamcrest-core</artifactId>
             <scope>provided</scope>
@@ -91,14 +96,6 @@
             <artifactId>jetty-servlet</artifactId>
             <scope>provided</scope>
         </dependency>
-        <!--
-        <dependency>
-            <groupId>org.eclipse.jetty.orbit</groupId>
-            <artifactId>javax.servlet</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        -->
-
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/src/main/java/org/apache/hadoop/test/log/NoOpLogger.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/hadoop/test/log/NoOpLogger.java b/gateway-test-utils/src/main/java/org/apache/hadoop/test/log/NoOpLogger.java
index 420deab..8fd24ed 100644
--- a/gateway-test-utils/src/main/java/org/apache/hadoop/test/log/NoOpLogger.java
+++ b/gateway-test-utils/src/main/java/org/apache/hadoop/test/log/NoOpLogger.java
@@ -64,6 +64,10 @@ public class NoOpLogger implements Logger {
   }
 
   @Override
+  public void debug( String msg, long arg ) {
+  }
+
+  @Override
   public void debug( Throwable thrown ) {
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletRequest.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletRequest.java b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletRequest.java
index 29198e7..82ebe3d 100644
--- a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletRequest.java
+++ b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletRequest.java
@@ -29,6 +29,7 @@ import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
 import javax.servlet.http.Part;
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -161,6 +162,11 @@ public class MockHttpServletRequest implements HttpServletRequest {
   }
 
   @Override
+  public String changeSessionId() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   public boolean isRequestedSessionIdValid() {
     return false;
   }
@@ -205,6 +211,11 @@ public class MockHttpServletRequest implements HttpServletRequest {
   }
 
   @Override
+  public <T extends HttpUpgradeHandler> T upgrade( Class<T> aClass ) throws IOException, ServletException {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
   public Object getAttribute( String s ) {
     return null;
   }
@@ -230,6 +241,11 @@ public class MockHttpServletRequest implements HttpServletRequest {
   }
 
   @Override
+  public long getContentLengthLong() {
+    return 0;
+  }
+
+  @Override
   public String getContentType() {
     return contentType;
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletResponse.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletResponse.java b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletResponse.java
index 3e84304..9d20d17 100644
--- a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletResponse.java
+++ b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockHttpServletResponse.java
@@ -151,6 +151,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
   }
 
   @Override
+  public void setContentLengthLong( long l ) {
+  }
+
+  @Override
   public void setContentType( String s ) {
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServer.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServer.java b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServer.java
index 508c71a..5d95ce6 100644
--- a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServer.java
+++ b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServer.java
@@ -90,7 +90,7 @@ public class MockServer {
   }
 
   public int getPort() {
-    return jetty.getConnectors()[0].getLocalPort();
+    return jetty.getURI().getPort();
   }
 
   public MockRequestMatcher expect() {

http://git-wip-us.apache.org/repos/asf/knox/blob/96e39622/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServletContext.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServletContext.java b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServletContext.java
index ff3094e..0df84c3 100644
--- a/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServletContext.java
+++ b/gateway-test-utils/src/main/java/org/apache/hadoop/test/mock/MockServletContext.java
@@ -285,4 +285,9 @@ public class MockServletContext implements ServletContext {
   @Override
   public void declareRoles( String... strings ) {
   }
+
+  @Override
+  public String getVirtualServerName() {
+    throw new UnsupportedOperationException();
+  }
 }


Mime
View raw message