Browse Source

deps: Update Jetty to version 9.4.49.v20220914

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.
pull/1438/head
Florian Zschocke 1 year ago
parent
commit
bb0b0eb824
4 changed files with 47 additions and 47 deletions
  1. 9
    9
      .classpath
  2. 1
    1
      build.moxie
  3. 27
    27
      gitblit.iml
  4. 10
    10
      src/main/java/com/gitblit/GitBlitServer.java

+ 9
- 9
.classpath View File

@@ -25,15 +25,15 @@
<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" />

+ 1
- 1
build.moxie View 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

+ 27
- 27
gitblit.iml View File

@@ -222,101 +222,101 @@
</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>

+ 10
- 10
src/main/java/com/gitblit/GitBlitServer.java View 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

Loading…
Cancel
Save