diff --git a/xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpBindManager.java b/xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpBindManager.java index 7e2287ad30..31d41bfeeb 100644 --- a/xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpBindManager.java +++ b/xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpBindManager.java @@ -19,9 +19,18 @@ import org.apache.tomcat.InstanceManager; import org.apache.tomcat.SimpleInstanceManager; import org.eclipse.jetty.ee8.apache.jsp.JettyJasperInitializer; +import org.eclipse.jetty.ee8.nested.ContextHandler; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; -import org.eclipse.jetty.server.*; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.ForwardedRequestCustomizer; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.SecureRequestCustomizer; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.Handler.Sequence; import org.eclipse.jetty.server.handler.gzip.GzipHandler; @@ -757,12 +766,12 @@ protected ServletContextHandler createStaticContentHandler() } /** - * Adds a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) - * functionality. + * Adds a Jetty handler to be added to the embedded web server that is used to expose Openfire's public + * web-bindings (eg: BOSH / HTTP-bind and websocket). * * @param handler The handler (cannot be null). */ - public void addJettyHandler( Handler handler ) + public void addJettyHandler(final ContextHandler handler) { if ( handler == null ) { @@ -785,17 +794,14 @@ public void addJettyHandler( Handler handler ) } /** - * Removes a Jetty handler to be added to the embedded web server that is used to expose BOSH (HTTP-bind) - * functionality. - * - * Removing a handler, even when null, or non-existing, might have side-effects as introduced by the Jetty - * implementation. At the time of writing, Jetty will re + * Removes a Jetty handler to be added to the embedded web server that is used to expose Openfire's public + * web-bindings (eg: BOSH / HTTP-bind and websocket). * * @param handler The handler (should not be null). */ - public void removeJettyHandler( Handler handler ) + public void removeJettyHandler(final ContextHandler handler) { - extensionHandlers.removeHandler( handler ); + extensionHandlers.removeHandler( handler.get() ); if ( handler.isStarted() ) { try @@ -807,7 +813,6 @@ public void removeJettyHandler( Handler handler ) Log.warn( "Unable to stop the handler that was removed: {}", handler, e ); } } - } private void doEnableHttpBind(boolean shouldEnable) {