From 29b4db5c34fbb7087bc6a08f3e393da32b39ce66 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon (cshannon)" Date: Fri, 9 Dec 2016 09:45:53 -0500 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-6521 Fixing support for Jetty 9.3 and Jetty 9.2. The previous attempt at a fix had the wrong class instance. --- .../activemq/transport/http/HttpTransportServer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java index f9774f3126..ca3bed806a 100644 --- a/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java +++ b/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java @@ -30,6 +30,7 @@ import org.eclipse.jetty.security.ConstraintSecurityHandler; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; @@ -124,13 +125,13 @@ public class HttpTransportServer extends WebTransportServerSupport { } private void addGzipHandler(ServletContextHandler contextHandler) throws Exception { - Handler handler = null; + HandlerWrapper handler = null; try { - handler = (Handler) forName("org.eclipse.jetty.server.handler.GzipHandler").newInstance(); + handler = (HandlerWrapper) forName("org.eclipse.jetty.servlets.gzip.GzipHandler").newInstance(); } catch (Throwable t) { - handler = (Handler) forName("org.eclipse.jetty.servlets.gzip.GzipHandler").newInstance(); + handler = (HandlerWrapper) forName("org.eclipse.jetty.server.handler.gzip.GzipHandler").newInstance(); } - contextHandler.setHandler(handler); + contextHandler.insertHandler(handler); } private Class forName(String name) throws ClassNotFoundException {