KNOX-1516 - Upgrade Jetty to 9.4.12
authorKevin Risden <krisden@apache.org>
Fri, 5 Oct 2018 14:26:39 +0000 (10:26 -0400)
committerKevin Risden <krisden@apache.org>
Fri, 9 Nov 2018 23:41:16 +0000 (18:41 -0500)
Signed-off-by: Kevin Risden <krisden@apache.org>
15 files changed:
gateway-provider-identity-assertion-common/pom.xml
gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/function/UsernameFunctionProcessorTest.java
gateway-provider-rewrite-func-service-registry/pom.xml
gateway-provider-rewrite-func-service-registry/src/test/java/org/apache/knox/gateway/svcregfunc/impl/ServiceRegistryFunctionsTest.java
gateway-provider-rewrite/pom.xml
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessorTest.java
gateway-server/src/main/java/org/apache/knox/gateway/filter/RequestUpdateHandler.java
gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
gateway-test-release/pom.xml
gateway-test-utils/pom.xml
gateway-test/src/test/java/org/apache/knox/gateway/GatewayMultiFuncTest.java
gateway-test/src/test/java/org/apache/knox/gateway/SimpleDescriptorHandlerFuncTest.java
pom.xml

index 946c550..65c6de5 100644 (file)
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-http</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.velocity</groupId>
             <artifactId>velocity</artifactId>
             <scope>test</scope>
index 75a00e5..8f81515 100644 (file)
@@ -33,7 +33,6 @@ import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
 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;
 import org.junit.After;
@@ -54,11 +53,13 @@ import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.ArrayDeque;
 import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Queue;
 import java.util.ServiceLoader;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -71,7 +72,7 @@ public class UsernameFunctionProcessorTest {
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
+  private Queue<MockInteraction> interactions;
   private MockInteraction interaction;
 
   private static URL getTestResource( String name ) {
@@ -101,7 +102,7 @@ public class UsernameFunctionProcessorTest {
     }
     rewriteFilter.setFilter( new UrlRewriteServletFilter() );
 
-    interactions = new ArrayQueue<>();
+    interactions = new ArrayDeque<>();
 
     ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
     servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
index 0216a82..c88f7f5 100644 (file)
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-http</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.velocity</groupId>
             <artifactId>velocity</artifactId>
             <scope>test</scope>
index f8e7560..ee1b9eb 100644 (file)
@@ -33,7 +33,6 @@ import org.eclipse.jetty.http.HttpTester;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.servlet.ServletTester;
-import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.log.Log;
 import org.hamcrest.core.Is;
 import org.junit.Test;
@@ -53,9 +52,11 @@ import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.ArrayDeque;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Queue;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 
@@ -65,7 +66,7 @@ public class ServiceRegistryFunctionsTest {
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
+  private Queue<MockInteraction> interactions;
   private MockInteraction interaction;
 
   private static URL getTestResource( String name ) {
@@ -105,8 +106,8 @@ public class ServiceRegistryFunctionsTest {
       }
     }
     rewriteFilter.setFilter( new UrlRewriteServletFilter() );
-
-    interactions = new ArrayQueue<>();
+    
+    interactions = new ArrayDeque<>();
 
     ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
     servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
index 20aa382..f17a1f1 100644 (file)
             <artifactId>gateway-test-utils</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-http</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
 
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
index 4223a46..0552b00 100644 (file)
@@ -23,20 +23,21 @@ import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
 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;
 
 import javax.servlet.DispatcherType;
 import java.net.URL;
+import java.util.ArrayDeque;
 import java.util.EnumSet;
+import java.util.Queue;
 
 public class UrlRewriteServletContextListenerTest {
 
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
+  private Queue<MockInteraction> interactions;
   private MockInteraction interaction;
 
   private static URL getTestResource( String name ) {
@@ -58,7 +59,7 @@ public class UrlRewriteServletContextListenerTest {
     FilterHolder filter = server.addFilter( UrlRewriteServletFilter.class, "/*", EnumSet.of( DispatcherType.REQUEST ) );
     filter.setFilter( new UrlRewriteServletFilter() );
 
-    interactions = new ArrayQueue<>();
+    interactions = new ArrayDeque<>();
 
     ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
     servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
index f857dcf..ab2a9fc 100644 (file)
@@ -30,7 +30,6 @@ import org.eclipse.jetty.http.HttpTester;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.servlet.ServletTester;
-import org.eclipse.jetty.util.ArrayQueue;
 import org.junit.After;
 import org.junit.Test;
 
@@ -46,10 +45,12 @@ import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayDeque;
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Queue;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.anyOf;
@@ -63,7 +64,7 @@ public class UrlRewriteServletFilterTest {
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
+  private Queue<MockInteraction> interactions;
   private MockInteraction interaction;
 
   private static URL getTestResource( String name ) {
@@ -90,7 +91,7 @@ public class UrlRewriteServletFilterTest {
     }
     rewriteFilter.setFilter( new UrlRewriteServletFilter() );
 
-    interactions = new ArrayQueue<>();
+    interactions = new ArrayDeque<>();
 
     ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
     servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
index de87d75..a0791fb 100644 (file)
@@ -37,7 +37,6 @@ import org.eclipse.jetty.http.HttpTester;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.servlet.ServletTester;
-import org.eclipse.jetty.util.ArrayQueue;
 import org.eclipse.jetty.util.Attributes;
 import org.eclipse.jetty.util.AttributesMap;
 import org.eclipse.jetty.util.log.Log;
@@ -59,10 +58,12 @@ import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.ArrayDeque;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Queue;
 import java.util.ServiceLoader;
 
 import static org.hamcrest.CoreMatchers.containsString;
@@ -76,7 +77,7 @@ public class FrontendFunctionProcessorTest {
   private ServletTester server;
   private HttpTester.Request request;
   private HttpTester.Response response;
-  private ArrayQueue<MockInteraction> interactions;
+  private Queue<MockInteraction> interactions;
   private MockInteraction interaction;
 
   @SuppressWarnings("rawtypes")
@@ -157,8 +158,8 @@ public class FrontendFunctionProcessorTest {
       }
     }
     rewriteFilter.setFilter( new UrlRewriteServletFilter() );
-
-    interactions = new ArrayQueue<>();
+    
+    interactions = new ArrayDeque<>();
 
     ServletHolder servlet = server.addServlet( MockServlet.class, "/" );
     servlet.setServlet( new MockServlet( "mock-servlet", interactions ) );
index 61bd09d..342c988 100644 (file)
@@ -87,8 +87,7 @@ public class RequestUpdateHandler extends ScopedHandler {
     // if the request already has the /{gatewaypath}/{topology} part then skip
     if (!StringUtils.startsWithIgnoreCase(target, redirectContext)) {
       baseRequest.setPathInfo(redirectContext + baseRequest.getPathInfo());
-      baseRequest.setUri(
-          new HttpURI(redirectContext + baseRequest.getUri().toString()));
+      baseRequest.setHttpURI(new HttpURI(redirectContext + baseRequest.getHttpURI()));
 
       LOG.topologyPortMappingUpdateRequest(target, newTarget);
       nextHandle(newTarget, baseRequest, newRequest, response);
index 366e1b0..558a739 100644 (file)
@@ -37,7 +37,7 @@ public class AccessHandler extends AbstractLifeCycle implements RequestLog {
       sb.append( "|" );
       sb.append( request.getMethod() );
       sb.append( "|" );
-      sb.append( request.getUri().toString() );
+      sb.append( request.getHttpURI() );
       sb.append( "|" );
       sb.append( request.getContentLength() );
       sb.append( "|" );
index be49e30..605ad67 100644 (file)
     </modules>
 
     <properties>
-        <!-- This property name must be different thant jetty.version
-             Otherwise Jetty 9.2.x and 9.3.x will not both be available.
-             Jetty 9.2.x is needed for Knox and Jetty 9.3.x for Hadoop -->
-        <hadoop-jetty.version>9.3.19.v20170502</hadoop-jetty.version>
+        <!-- This property name must be different than jetty.version
+             Otherwise Jetty 9.3.x and 9.4.x will not both be available.
+             Jetty 9.4.x is needed for Knox and Jetty 9.3.x for Hadoop -->
+        <hadoop-jetty.version>9.3.25.v20180904</hadoop-jetty.version>
     </properties>
 
     <dependencies>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-client</artifactId>
+            <version>${hadoop-jetty.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-http</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-io</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-annotations</artifactId>
+            <version>${hadoop-jetty.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-webapp</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-util</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
             <version>${hadoop-jetty.version}</version>
             <exclusions>
index f90edb0..eddfb21 100644 (file)
             <artifactId>javax.servlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
-        
+
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <classifier>tests</classifier>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-http</artifactId>
+            <classifier>tests</classifier>
+        </dependency>
     </dependencies>
 </project>
index 5fb94b3..1deb738 100644 (file)
@@ -185,7 +185,7 @@ public class GatewayMultiFuncTest {
         .then()
         //.log().all()
         .statusCode( HttpStatus.SC_OK )
-        .contentType( "application/json; charset=UTF-8" )
+        .contentType( "application/json;charset=UTF-8" )
         .when().get( gatewayUrl + "/knox678/repeat" ).andReturn().asString();
     assertThat( json, is("{\"msg\":\"H\u00eallo\"}") );
     assertThat( mock.isEmpty(), is(true) );
@@ -232,7 +232,7 @@ public class GatewayMultiFuncTest {
         .status( HttpStatus.SC_CREATED )
         .content( "{\"name\":\"value\"}".getBytes(StandardCharsets.UTF_8) )
         .contentLength( -1 )
-        .contentType( "application/json; charset=UTF-8" )
+        .contentType( "application/json;charset=UTF-8" )
         .header( "Location", gatewayUrl + "/knox681/repeat" );
 
     String uname = "guest";
@@ -259,7 +259,7 @@ public class GatewayMultiFuncTest {
     CloseableHttpResponse response = client.execute( request, context );
     assertThat( response.getStatusLine().getStatusCode(), is( HttpStatus.SC_CREATED ) );
     assertThat( response.getFirstHeader( "Location" ).getValue(), endsWith("/gateway/knox681/repeat" ) );
-    assertThat( response.getFirstHeader( "Content-Type" ).getValue(), is("application/json; charset=UTF-8") );
+    assertThat( response.getFirstHeader( "Content-Type" ).getValue(), is("application/json;charset=utf-8") );
     String body = new String( IOUtils.toByteArray( response.getEntity().getContent() ), StandardCharsets.UTF_8 );
     assertThat( body, is( "{\"name\":\"value\"}" ) );
     response.close();
index f7c2103..e01dcbb 100644 (file)
@@ -165,6 +165,7 @@ public class SimpleDescriptorHandlerFuncTest {
       EasyMock.expect(config.getGatewayDeploymentDir()).andReturn(testDeployDir.getAbsolutePath()).anyTimes();
       EasyMock.expect(config.getGatewayAddress()).andReturn(gatewayAddress).anyTimes();
       EasyMock.expect(config.getGatewayPortMappings()).andReturn(Collections.emptyMap()).anyTimes();
+      EasyMock.expect(config.getThreadPoolMax()).andReturn(200).anyTimes();
       EasyMock.replay(config);
 
       // Setup the Gateway Services
diff --git a/pom.xml b/pom.xml
index b12b3b2..e6e9103 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <apacheds.version>2.0.0-M24</apacheds.version>
         <apacheds-jdbm.version>2.0.0-M5</apacheds-jdbm.version>
         <ant-nodeps.version>1.8.1</ant-nodeps.version>
+        <asm.version>7.0</asm.version>
         <buildnumber-maven-plugin.version>1.4</buildnumber-maven-plugin.version>
         <checkstyle.version>8.14</checkstyle.version>
+        <cglib.version>3.2.9</cglib.version>
         <commons-beanutils.version>1.9.3</commons-beanutils.version>
         <commons-cli.version>1.4</commons-cli.version>
         <commons-codec.version>1.11</commons-codec.version>
         <javax.websocket-api.version>1.1</javax.websocket-api.version>
         <jericho-html.version>3.4</jericho-html.version>
         <jersey.version>2.6</jersey.version>
-        <jetty.version>9.2.26.v20180806</jetty.version>
+        <jetty.version>9.4.12.v20180830</jetty.version>
         <jline.version>2.14.6</jline.version>
         <jna.version>5.0.0</jna.version>
         <joda-time.version>2.10.1</joda-time.version>
             </dependency>
 
             <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-servlet</artifactId>
+                <version>${jetty.version}</version>
+                <classifier>tests</classifier>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-http</artifactId>
+                <version>${jetty.version}</version>
+                <classifier>tests</classifier>
+            </dependency>
+
+            <dependency>
                 <groupId>javax.annotation</groupId>
                 <artifactId>javax.annotation-api</artifactId>
                 <version>${javax.annotation-api.version}</version>
             </dependency>
 
             <dependency>
+                <groupId>cglib</groupId>
+                <artifactId>cglib</artifactId>
+                <version>${cglib.version}</version>
+            </dependency>
+
+            <dependency>
                 <groupId>commons-beanutils</groupId>
                 <artifactId>commons-beanutils</artifactId>
                 <version>${commons-beanutils.version}</version>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-digester3</artifactId>
                 <version>${commons-digester3.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>cglib</groupId>
+                        <artifactId>cglib</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>commons-io</groupId>
             </dependency>
 
             <dependency>
+                <groupId>org.ow2.asm</groupId>
+                <artifactId>asm</artifactId>
+                <version>${asm.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.ow2.asm</groupId>
+                <artifactId>asm-commons</artifactId>
+                <version>${asm.version}</version>
+            </dependency>
+
+            <dependency>
                 <groupId>org.eclipse.jetty</groupId>
                 <artifactId>jetty-io</artifactId>
                 <version>${jetty.version}</version>
                 <artifactId>javax.websocket-api</artifactId>
                 <version>${javax.websocket-api.version}</version>
             </dependency>
+            <dependency>
+                <groupId>javax.websocket</groupId>
+                <artifactId>javax.websocket-client-api</artifactId>
+                <version>${javax.websocket-api.version}</version>
+            </dependency>
             
             <dependency>
                 <groupId>org.eclipse.jetty.websocket</groupId>