You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2018/10/30 19:54:31 UTC

knox git commit: KNOX-1531 - Remove gzip handler added by KNOX-732

Repository: knox
Updated Branches:
  refs/heads/master 33fc9e93b -> d3cea9608


KNOX-1531 - Remove gzip handler added by KNOX-732

Signed-off-by: Kevin Risden <kr...@apache.org>


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

Branch: refs/heads/master
Commit: d3cea960813b2308466f1772392d0038349f85b8
Parents: 33fc9e9
Author: Kevin Risden <kr...@apache.org>
Authored: Fri Oct 19 14:52:56 2018 -0400
Committer: Kevin Risden <kr...@apache.org>
Committed: Tue Oct 30 14:54:00 2018 -0400

----------------------------------------------------------------------
 gateway-server/pom.xml                          |  4 ---
 .../org/apache/knox/gateway/GatewayServer.java  | 13 +--------
 .../gateway/config/impl/GatewayConfigImpl.java  | 30 --------------------
 .../knox/gateway/GatewayGlobalConfigTest.java   | 25 ----------------
 .../knox/gateway/config/GatewayConfig.java      |  6 ----
 .../apache/knox/gateway/GatewayTestConfig.java  |  8 ------
 pom.xml                                         |  5 ----
 7 files changed, 1 insertion(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-server/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-server/pom.xml b/gateway-server/pom.xml
index 1e04a25..35c2f38 100644
--- a/gateway-server/pom.xml
+++ b/gateway-server/pom.xml
@@ -123,10 +123,6 @@
         </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlets</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-util</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index ac5674e..ddcba82 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -66,7 +66,6 @@ import org.eclipse.jetty.server.handler.ContextHandler;
 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.servlets.gzip.GzipHandler;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.Configuration;
@@ -422,19 +421,9 @@ public class GatewayServer {
     CorrelationHandler correlationHandler = new CorrelationHandler();
     correlationHandler.setHandler( traceHandler );
 
-    /* KNOX-732: Handler for GZip compression */
-    GzipHandler gzipHandler = new GzipHandler();
-    String[] mimeTypes = {};
-    if (config.getMimeTypesToCompress() != null
-        && !config.getMimeTypesToCompress().isEmpty()) {
-      mimeTypes = config.getMimeTypesToCompress().toArray(new String[0]);
-    }
-    gzipHandler.addIncludedMimeTypes(mimeTypes);
-    gzipHandler.setHandler(correlationHandler);
-
     // Used to correct the {target} part of request with Topology Port Mapping feature
     final PortMappingHelperHandler portMappingHandler = new PortMappingHelperHandler(config);
-    portMappingHandler.setHandler(gzipHandler);
+    portMappingHandler.setHandler(correlationHandler);
 
      // If topology to port mapping feature is enabled then we add new Handler {RequestForwardHandler}
      // to the chain, this handler listens on the configured port (in gateway-site.xml)

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java b/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
index f2b0af6..cb3cb06 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
@@ -163,13 +163,6 @@ public class GatewayConfigImpl extends Configuration implements GatewayConfig {
   public static final String GATEWAY_PORT_MAPPING_REGEX = GATEWAY_CONFIG_FILE_PREFIX + "\\.port\\.mapping\\..*";
   public static final String GATEWAY_PORT_MAPPING_ENABLED = GATEWAY_PORT_MAPPING_PREFIX + "enabled";
 
-  /**
-   * Comma-separated list of MIME Types to be compressed by Knox on the way out.
-   *
-   * @since 0.12
-   */
-  public static final String MIME_TYPES_TO_COMPRESS = GATEWAY_CONFIG_FILE_PREFIX + ".gzip.compress.mime.types";
-
   public static final String CLUSTER_CONFIG_MONITOR_PREFIX = GATEWAY_CONFIG_FILE_PREFIX + ".cluster.config.monitor.";
   public static final String CLUSTER_CONFIG_MONITOR_INTERVAL_SUFFIX = ".interval";
   public static final String CLUSTER_CONFIG_MONITOR_ENABLED_SUFFIX = ".enabled";
@@ -216,13 +209,6 @@ public class GatewayConfigImpl extends Configuration implements GatewayConfig {
   public static final boolean DEFAULT_REMOTE_ALIAS_SERVICE_ENABLED = true;
   public static final boolean DEFAULT_STRICT_TOPOLOGY_VALIDATION = false;
 
-  /**
-   * Default list of MIME Type to be compressed.
-   * @since 0.12
-   */
-  public static final String DEFAULT_MIME_TYPES_TO_COMPRESS =
-        "text/html, text/plain, text/xml, text/css, application/javascript, application/x-javascript, text/javascript";
-
   public static final String COOKIE_SCOPING_ENABLED = GATEWAY_CONFIG_FILE_PREFIX + ".scope.cookies.feature.enabled";
   public static final boolean DEFAULT_COOKIE_SCOPING_FEATURE_ENABLED = false;
   private static final String CRYPTO_ALGORITHM = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.algorithm";
@@ -868,22 +854,6 @@ public class GatewayConfigImpl extends Configuration implements GatewayConfig {
     return getInt( WEBSOCKET_IDLE_TIMEOUT, DEFAULT_WEBSOCKET_IDLE_TIMEOUT);
   }
 
-  /*
-   * (non-Javadoc)
-   *
-   * @see
-   * GatewayConfig#getMimeTypesToCompress()
-   */
-  @Override
-  public List<String> getMimeTypesToCompress() {
-    List<String> mimeTypes = null;
-    String value = get(MIME_TYPES_TO_COMPRESS, DEFAULT_MIME_TYPES_TO_COMPRESS);
-    if (value != null && !value.isEmpty()) {
-      mimeTypes = Arrays.asList(value.trim().split("\\s*,\\s*"));
-    }
-    return mimeTypes;
-  }
-
   /**
    * Map of Topology names and their ports.
    *

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
index a9c732c..439b69e 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
@@ -25,8 +25,6 @@ import org.junit.Test;
 
 import java.io.File;
 import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
@@ -191,27 +189,4 @@ public class GatewayGlobalConfigTest {
     config = new GatewayConfigImpl();
     assertEquals("target/test", config.getGatewayServicesDir());
   }
-
-  /**
-   * Test for the default Mime Types for Gzip compression.
-   *
-   * @since 0.12
-   */
-  @Test
-  public void testDefaultCompressGzipMimeTypes() {
-
-    final List<String> expected = Arrays.asList("text/javascript", "text/html",
-        "text/plain", "text/xml", "text/css", "application/javascript",
-        "application/x-javascript");
-
-    String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
-    System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
-    GatewayConfig config = new GatewayConfigImpl();
-
-    assertTrue("Default MIME Types for Gzip compression failed to match",
-        config.getMimeTypesToCompress().containsAll(expected));
-
-  }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java b/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
index 75090ee..416160b 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
@@ -234,12 +234,6 @@ public interface GatewayConfig {
   int getGraphiteReportingFrequency();
 
   /**
-   * List of MIME Type to be compressed.
-   * @since 0.12
-   */
-  List<String> getMimeTypesToCompress();
-
-  /**
    * Enable cookie scoping to gateway path
    *
    * @since 0.13

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
----------------------------------------------------------------------
diff --git a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
index f7339d6..edf47ce 100644
--- a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
+++ b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
@@ -537,14 +537,6 @@ public class GatewayTestConfig extends Configuration implements GatewayConfig {
     return 0;
   }
 
-  /* (non-Javadoc)
-   * @see GatewayConfig#getMimeTypesToCompress()
-   */
-  @Override
-  public List<String> getMimeTypesToCompress() {
-    return new ArrayList<String>();
-  }
-
   @Override
   public  boolean isCookieScopingToPathEnabled() {
     return false;

http://git-wip-us.apache.org/repos/asf/knox/blob/d3cea960/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 017acdd..e7f9b08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -922,11 +922,6 @@
                 <artifactId>jetty-webapp</artifactId>
                 <version>${jetty.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.eclipse.jetty</groupId>
-                <artifactId>jetty-servlets</artifactId>
-                <version>${jetty.version}</version>
-            </dependency>
 
             <dependency>
                 <groupId>javax.annotation</groupId>