]> source.dussan.org Git - gitblit.git/commitdiff
deps: Update Jetty to version 9.4.49.v20220914
authorFlorian Zschocke <f.zschocke+git@gmail.com>
Sun, 13 Nov 2022 18:25:17 +0000 (19:25 +0100)
committerFlorian Zschocke <f.zschocke+git@gmail.com>
Sun, 13 Nov 2022 18:26:41 +0000 (19:26 +0100)
This updates Jetty to the latest 9.x version as of writing. The 9.x is
still running on Java 8. The update needs two code changes.

`SessionManager` was replaced with `SessionHandler`. This was documented
in the Jetty documentation.

Adding the `GitblitContext` to the `WebAppContext` will result in two
instances getting created, because the code was changed that prevents
instantiation the same listener class multiple times. (The second time
is when the web.xml is read.) Instead, it must be added to the servlet
handler of the `WebAppContext`. This results in properly adhering to the
changed internal startup flow.

Updating Jetty also resolves #1409.

.classpath
build.moxie
gitblit.iml
src/main/java/com/gitblit/GitBlitServer.java

index c39b210a34ab4c2c89be662d1a8cc8c39a028b0a..e9512b693121bada5221c92909441da56ea8be8f 100644 (file)
        <classpathentry kind="lib" path="ext/javax.mail-1.5.6.jar" sourcepath="ext/src/javax.mail-1.5.6.jar" />
        <classpathentry kind="lib" path="ext/activation-1.1.jar" sourcepath="ext/src/activation-1.1.jar" />
        <classpathentry kind="lib" path="ext/javax.servlet-api-3.1.0.jar" sourcepath="ext/src/javax.servlet-api-3.1.0.jar" />
-       <classpathentry kind="lib" path="ext/jetty-servlet-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-servlet-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-security-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-security-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-server-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-server-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-continuation-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-continuation-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-http-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-http-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-io-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-io-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-util-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-util-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-webapp-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-webapp-9.3.16.v20170120.jar" />
-       <classpathentry kind="lib" path="ext/jetty-xml-9.3.16.v20170120.jar" sourcepath="ext/src/jetty-xml-9.3.16.v20170120.jar" />
+       <classpathentry kind="lib" path="ext/jetty-servlet-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-servlet-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-security-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-security-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-server-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-server-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-continuation-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-continuation-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-http-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-http-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-io-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-io-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-util-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-util-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-webapp-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-webapp-9.4.49.v20220914.jar" />
+       <classpathentry kind="lib" path="ext/jetty-xml-9.4.49.v20220914.jar" sourcepath="ext/src/jetty-xml-9.4.49.v20220914.jar" />
        <classpathentry kind="lib" path="ext/wicket-1.4.22.jar" sourcepath="ext/src/wicket-1.4.22.jar" />
        <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.22.jar" sourcepath="ext/src/wicket-auth-roles-1.4.22.jar" />
        <classpathentry kind="lib" path="ext/wicket-extensions-1.4.22.jar" sourcepath="ext/src/wicket-extensions-1.4.22.jar" />
index dd26d3f646bd6fc16fc329243f87326faa122b51..0631391d402c4904c9ba87baa9b0666a1a2c311e 100644 (file)
@@ -105,7 +105,7 @@ repositories: central, eclipse-snapshots, eclipse, gitblit
 
 # Convenience properties for dependencies
 properties: {
-  jetty.version  : 9.3.16.v20170120
+  jetty.version  : 9.4.49.v20220914
   slf4j.version  : 1.7.29
   wicket.version : 1.4.22
   lucene.version : 5.5.2
index 2f1bfb32d70cc2ab2b709d6429f2208d6410bc4f..49b2deddbd3bbf375c944049fe30f17d876f57e5 100644 (file)
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-servlet-9.3.16.v20170120.jar">
+      <library name="jetty-servlet-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-servlet-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-servlet-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-servlet-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-servlet-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-security-9.3.16.v20170120.jar">
+      <library name="jetty-security-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-security-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-security-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-security-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-security-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-server-9.3.16.v20170120.jar">
+      <library name="jetty-server-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-server-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-server-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-server-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-server-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-continuation-9.3.16.v20170120.jar">
+      <library name="jetty-continuation-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-continuation-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-continuation-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-continuation-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-continuation-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-http-9.3.16.v20170120.jar">
+      <library name="jetty-http-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-http-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-http-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-http-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-http-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-io-9.3.16.v20170120.jar">
+      <library name="jetty-io-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-io-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-io-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-io-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-io-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-util-9.3.16.v20170120.jar">
+      <library name="jetty-util-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-util-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-util-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-util-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-util-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-webapp-9.3.16.v20170120.jar">
+      <library name="jetty-webapp-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-webapp-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-webapp-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-webapp-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-webapp-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
     <orderEntry type="module-library">
-      <library name="jetty-xml-9.3.16.v20170120.jar">
+      <library name="jetty-xml-9.4.49.v20220914.jar">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/ext/jetty-xml-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/jetty-xml-9.4.49.v20220914.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/ext/src/jetty-xml-9.3.16.v20170120.jar!/" />
+          <root url="jar://$MODULE_DIR$/ext/src/jetty-xml-9.4.49.v20220914.jar!/" />
         </SOURCES>
       </library>
     </orderEntry>
index ae01e8e0f55d0b203664d4011f9abf858552282c..d91b3be040b832e5678267820a82ea1ca416a17e 100644 (file)
@@ -44,7 +44,8 @@ import org.eclipse.jetty.server.HttpConfiguration;
 import org.eclipse.jetty.server.HttpConnectionFactory;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.session.HashSessionManager;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.servlet.ListenerHolder;
 import org.eclipse.jetty.util.security.Constraint;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.webapp.WebAppContext;
@@ -302,7 +303,6 @@ public class GitBlitServer {
                                }
 
                                ServerConnector connector = new ServerConnector(server, factory);
-                               connector.setSoLingerTime(-1);
                                connector.setIdleTimeout(settings.getLong(Keys.server.httpIdleTimeout, 30000L));
                                connector.setPort(params.securePort);
                                String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
@@ -339,7 +339,6 @@ public class GitBlitServer {
                httpConfig.setSendDateHeader(false);
 
                        ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
-                       connector.setSoLingerTime(-1);
                        connector.setIdleTimeout(settings.getLong(Keys.server.httpIdleTimeout, 30000L));
                        connector.setPort(params.port);
                        String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
@@ -381,13 +380,13 @@ public class GitBlitServer {
                rootContext.setWar(location.toExternalForm());
                rootContext.setTempDirectory(tempDir);
 
+
                // Set cookies HttpOnly so they are not accessible to JavaScript engines
-               HashSessionManager sessionManager = new HashSessionManager();
-               sessionManager.setHttpOnly(true);
+               SessionHandler sessionHandler = rootContext.getSessionHandler();
+               sessionHandler.setHttpOnly(true);
                // Use secure cookies if only serving https
-               sessionManager.setSecureRequestOnly( (params.port <= 0 && params.securePort > 0) ||
-                               (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) );
-               rootContext.getSessionHandler().setSessionManager(sessionManager);
+               sessionHandler.setSecureRequestOnly( (params.port <= 0 && params.securePort > 0) ||
+                                                                                        (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) );
 
                // Ensure there is a defined User Service
                String realmUsers = params.userService;
@@ -457,8 +456,9 @@ public class GitBlitServer {
                }
 
                // Setup the Gitblit context
-               GitblitContext gitblit = newGitblit(settings, baseFolder);
-               rootContext.addEventListener(gitblit);
+               ListenerHolder gitblitHolder = new ListenerHolder(GitblitContext.class);
+               gitblitHolder.setListener(newGitblit(settings, baseFolder));
+               rootContext.getServletHandler().addListener(gitblitHolder);
 
                try {
                        // start the shutdown monitor