Fixing support for Jetty 9.3 and Jetty 9.2.  The previous attempt at a
fix had the wrong class instance.
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-12-09 09:45:53 -05:00
parent 1a2e3eb0c7
commit 29b4db5c34
1 changed files with 5 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletHolder;
@ -124,13 +125,13 @@ public class HttpTransportServer extends WebTransportServerSupport {
} }
private void addGzipHandler(ServletContextHandler contextHandler) throws Exception { private void addGzipHandler(ServletContextHandler contextHandler) throws Exception {
Handler handler = null; HandlerWrapper handler = null;
try { try {
handler = (Handler) forName("org.eclipse.jetty.server.handler.GzipHandler").newInstance(); handler = (HandlerWrapper) forName("org.eclipse.jetty.servlets.gzip.GzipHandler").newInstance();
} catch (Throwable t) { } 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 { private Class<?> forName(String name) throws ClassNotFoundException {