From 1cf738767c2265dca702bf9db2efd925f9ab2c7c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 15:30:36 +0000 Subject: [PATCH 01/39] Update Jetty packages --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 7c861d34..64281785 100644 --- a/build.gradle +++ b/build.gradle @@ -66,8 +66,8 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'javax.servlet:javax.servlet-api:4.0.1' implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' - implementation 'org.eclipse.jetty:jetty-servlet:9.4.54.v20240208' - implementation 'org.eclipse.jetty:jetty-xml:9.4.54.v20240208' + implementation 'org.eclipse.jetty:jetty-servlet:11.0.21' + implementation 'org.eclipse.jetty:jetty-xml:12.0.9' implementation 'org.mozilla:rhino:1.7.13' implementation 'org.sejda.imageio:webp-imageio:0.1.6' implementation 'xerces:xercesImpl:2.12.2' From ed575bc4c5f5e047ec50642666343398db509507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sun, 19 May 2024 02:05:49 +0200 Subject: [PATCH 02/39] Update README.md Minor edits --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a735855f..2a134485 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ Helma is built with [Gradle](https://gradle.org), the build task depends on the ### Additional Prerequisites * [Rsync](https://rsync.samba.org) version ≥ 3.1.0 -* [NodeJS](https://nodejs.org) LTS version +* [Node.js](https://nodejs.org) LTS version -Clone this repository to your machine and start the build process with `./gradlew install`. The build script is going to ask you if you want to update the installation, enter `y`. +Clone this repository to your machine and start the build process with `./gradlew install`. The build script is going to ask you if you want to update the installation, enter `yes` or `no`. > ⚠️ > Please be aware that this step is going to overwrite files in the installation directory – escpecially at a later time when there might be substantial changes. Should this happen by accident you find the previous installation in the `backups` directory. From c087cb731eef411e278b65ed0c75ef9743cd7810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 14:11:15 +0200 Subject: [PATCH 03/39] Use correct version of Jetty servlet --- build.gradle | 2 +- src/main/java/helma/main/ApplicationManager.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 68e45638..9cf24ba9 100644 --- a/build.gradle +++ b/build.gradle @@ -66,7 +66,7 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'javax.servlet:javax.servlet-api:4.0.1' implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' - implementation 'org.eclipse.jetty:jetty-servlet:11.0.21' + implementation 'org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.9' implementation 'org.eclipse.jetty:jetty-xml:12.0.9' implementation 'org.mozilla:rhino:1.7.13' implementation 'org.sejda.imageio:webp-imageio:0.1.6' diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 2deb88ee..edce8483 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -22,8 +22,8 @@ import org.apache.xmlrpc.XmlRpcHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ResourceHandler; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.ee9.servlet.ServletContextHandler; +import org.eclipse.jetty.ee9.servlet.ServletHolder; import helma.framework.core.Application; import helma.framework.repository.FileRepository; From a943124d45ce51c8c4be9b39fb9bc937e45312da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:04:17 +0200 Subject: [PATCH 04/39] Fix creating Jetty server from config file --- src/main/java/helma/main/JettyServer.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/helma/main/JettyServer.java b/src/main/java/helma/main/JettyServer.java index 88ba8c10..cfd30264 100644 --- a/src/main/java/helma/main/JettyServer.java +++ b/src/main/java/helma/main/JettyServer.java @@ -16,11 +16,12 @@ package helma.main; - import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.util.resource.Resource; +import org.eclipse.jetty.util.resource.URLResourceFactory; import org.eclipse.jetty.xml.XmlConfiguration; import java.net.URL; @@ -36,18 +37,20 @@ public class JettyServer { public static JettyServer init(Server server, ServerConfig config) throws IOException { File configFile = config.getConfigFile(); if (configFile != null && configFile.exists()) { - return new JettyServer(configFile.toURI().toURL()); + URLResourceFactory resourceFactory = new URLResourceFactory(); + Resource resource = resourceFactory.newResource(configFile.toURI()); + return new JettyServer(resource); } else if (config.hasWebsrvPort()) { return new JettyServer(config.getWebsrvPort(), server); } return null; } - private JettyServer(URL url) throws IOException { + private JettyServer(Resource resource) throws IOException { http = new org.eclipse.jetty.server.Server(); try { - XmlConfiguration config = new XmlConfiguration(url); + XmlConfiguration config = new XmlConfiguration(resource); config.configure(http); } catch (IOException e) { @@ -59,7 +62,7 @@ public class JettyServer { private JettyServer(InetSocketAddress webPort, Server server) throws IOException { - + http = new org.eclipse.jetty.server.Server(); // start embedded web server if port is specified From 26975a109a0a13771eb3e955ceca930de9e10103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:07:22 +0200 Subject: [PATCH 05/39] Method ServerConnector.setSoLingerTime() was removed --- src/main/java/helma/main/JettyServer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/helma/main/JettyServer.java b/src/main/java/helma/main/JettyServer.java index cfd30264..c28be40a 100644 --- a/src/main/java/helma/main/JettyServer.java +++ b/src/main/java/helma/main/JettyServer.java @@ -76,7 +76,6 @@ public class JettyServer { connector.setHost(webPort.getAddress().getHostAddress()); connector.setPort(webPort.getPort()); connector.setIdleTimeout(30000); - connector.setSoLingerTime(-1); connector.setAcceptorPriorityDelta(0); connector.setAcceptQueueSize(0); From 62630ae0687524f743b8332af59c412dad480eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:08:17 +0200 Subject: [PATCH 06/39] Modernize for loop --- src/main/java/helma/main/JettyServer.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/helma/main/JettyServer.java b/src/main/java/helma/main/JettyServer.java index c28be40a..83e09bcf 100644 --- a/src/main/java/helma/main/JettyServer.java +++ b/src/main/java/helma/main/JettyServer.java @@ -102,12 +102,13 @@ public class JettyServer { } private void openListeners() throws IOException { - // opening the listener here allows us to run on priviledged port 80 under jsvc + // opening the listener here allows us to run on privileged port 80 under jsvc // even as non-root user, because init() is called with root privileges // while start() will be called with the user we will actually run as - Connector[] connectors = http.getConnectors(); - for (int i = 0; i < connectors.length; i++) { - ((ServerConnector) connectors[i]).open(); + for (var connector : http.getConnectors()) { + if (connector instanceof ServerConnector) { + ((ServerConnector) connector).open(); + } } } } From 0165e7c80ee63a5415f7a8c28e8ef771e9bb7d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:17:43 +0200 Subject: [PATCH 07/39] Fix setup of static resource --- src/main/java/helma/main/ApplicationManager.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index edce8483..c56ccce0 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -19,11 +19,13 @@ import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.xmlrpc.XmlRpcHandler; + import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ResourceHandler; import org.eclipse.jetty.ee9.servlet.ServletContextHandler; import org.eclipse.jetty.ee9.servlet.ServletHolder; +import org.eclipse.jetty.util.resource.ResourceFactory; import helma.framework.core.Application; import helma.framework.repository.FileRepository; @@ -481,19 +483,21 @@ public class ApplicationManager implements XmlRpcHandler { // if there is a static direcory specified, mount it if (this.staticDir != null) { + String staticPath = getAbsoluteFile(this.staticDir).getPath(); - File staticContent = getAbsoluteFile(this.staticDir); - - getLogger().info("Serving static from " + staticContent.getPath()); + getLogger().info("Serving static from " + staticPath); getLogger().info("Mounting static at " + staticMountpoint); ResourceHandler rhandler = new ResourceHandler(); - rhandler.setResourceBase(staticContent.getPath()); + rhandler.setBaseResource(ResourceFactory.of(rhandler).newResource(staticPath)); rhandler.setWelcomeFiles(staticHome); - staticContext = ApplicationManager.this.context.addContext(staticMountpoint, ""); //$NON-NLS-1$ + ContextHandler staticContext = new ContextHandler(); + staticContext.setContextPath(staticMountpoint); + staticContext.setBaseResourceAsString(""); staticContext.setHandler(rhandler); + ApplicationManager.this.context.addHandler(staticContext); staticContext.start(); } From 304ea4e456f5e585b66bda940fb58708df5f3cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:21:56 +0200 Subject: [PATCH 08/39] Fix creation of app context --- src/main/java/helma/main/ApplicationManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index c56ccce0..78f66623 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -501,7 +501,10 @@ public class ApplicationManager implements XmlRpcHandler { staticContext.start(); } - appContext = new ServletContextHandler(context, pathPattern, true, true); + appContext = new ServletContextHandler(ServletContextHandler.SESSIONS); + appContext.setContextPath(pathPattern); + context.addHandler(appContext); + Class servletClass = servletClassName == null ? EmbeddedServletClient.class : Class.forName(servletClassName); ServletHolder holder = new ServletHolder(servletClass); From fa59a2785858b4b77c14a7c789c2e5ede21c68c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:24:28 +0200 Subject: [PATCH 09/39] Fix creation of protected context --- src/main/java/helma/main/ApplicationManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 78f66623..6bb1eb58 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -536,10 +536,9 @@ public class ApplicationManager implements XmlRpcHandler { } if (protectedStaticDir != null) { - File protectedContent = getAbsoluteFile(protectedStaticDir); - appContext.setResourceBase(protectedContent.getPath()); - getLogger().info("Serving protected static from " + - protectedContent.getPath()); + String protectedContent = getAbsoluteFile(protectedStaticDir).getPath(); + appContext.setBaseResourceAsString(protectedContent); + getLogger().info("Serving protected static from " + protectedContent); } // Remap the context paths and start From d67d0235bd11dcdd13f0b3dcea8e0d3cadd6d90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:25:41 +0200 Subject: [PATCH 10/39] Prevent java.lang.IllegalStateException: Shared scheduler not started --- src/main/java/helma/main/ApplicationManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 6bb1eb58..755b65b8 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -543,7 +543,9 @@ public class ApplicationManager implements XmlRpcHandler { // Remap the context paths and start ApplicationManager.this.context.mapContexts(); - this.appContext.start(); + // FIXME: Causing java.lang.IllegalStateException: Shared scheduler not started + // Is it necessary, anway? + //this.appContext.start(); } // register as XML-RPC handler From 441d952b3502949862f2beeea75a2262934ba959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:26:18 +0200 Subject: [PATCH 11/39] Prevent incompatible types: ServletContextHandler cannot be converted to Handler --- src/main/java/helma/main/ApplicationManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 755b65b8..2c9c357c 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -564,7 +564,9 @@ public class ApplicationManager implements XmlRpcHandler { // unbind from Jetty HTTP server if (ApplicationManager.this.jetty != null) { if (this.appContext != null) { - ApplicationManager.this.context.removeHandler(this.appContext); + // FIXME: Causing incompatible types: ServletContextHandler cannot be converted to Handler + // Is it necessary, anyway? + //ApplicationManager.this.context.removeHandler(this.appContext); this.appContext.stop(); this.appContext.destroy(); this.appContext = null; From 973b3493cb996f4501e6755e2dd20eb8a89f1ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:30:10 +0200 Subject: [PATCH 12/39] Prevent java.lang.IllegalArgumentException: Resource String is invalid --- src/main/java/helma/main/ApplicationManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 2c9c357c..957eb7fe 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -494,7 +494,8 @@ public class ApplicationManager implements XmlRpcHandler { ContextHandler staticContext = new ContextHandler(); staticContext.setContextPath(staticMountpoint); - staticContext.setBaseResourceAsString(""); + // FIXME: Causing java.lang.IllegalArgumentException: Resource String is invalid + //staticContext.setBaseResourceAsString(""); staticContext.setHandler(rhandler); ApplicationManager.this.context.addHandler(staticContext); From 3dbcd792a6319d16b97548aca462d5b9b5a45e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:44:59 +0200 Subject: [PATCH 13/39] Migrate to Jakarte servlet API 5 --- build.gradle | 2 +- src/main/java/helma/framework/CookieTrans.java | 2 +- src/main/java/helma/framework/RequestBean.java | 6 +++--- src/main/java/helma/framework/RequestTrans.java | 6 +++--- src/main/java/helma/framework/ResponseBean.java | 2 +- src/main/java/helma/framework/ResponseTrans.java | 2 +- src/main/java/helma/servlet/AbstractServletClient.java | 10 ++++++---- src/main/java/helma/servlet/EmbeddedServletClient.java | 2 +- .../java/helma/servlet/StandaloneServletClient.java | 6 +++--- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 9cf24ba9..700545c0 100644 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,7 @@ dependencies { implementation 'commons-logging:commons-logging:1.3.2' implementation 'commons-net:commons-net:3.10.0' implementation 'com.sun.mail:javax.mail:1.6.2' - implementation 'javax.servlet:javax.servlet-api:4.0.1' + implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' implementation 'org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.9' implementation 'org.eclipse.jetty:jetty-xml:12.0.9' diff --git a/src/main/java/helma/framework/CookieTrans.java b/src/main/java/helma/framework/CookieTrans.java index fed45960..5293b843 100644 --- a/src/main/java/helma/framework/CookieTrans.java +++ b/src/main/java/helma/framework/CookieTrans.java @@ -17,7 +17,7 @@ package helma.framework; import java.io.Serializable; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.Cookie; /** * Cookie Transmitter. A simple, serializable representation diff --git a/src/main/java/helma/framework/RequestBean.java b/src/main/java/helma/framework/RequestBean.java index 49091022..bf377a63 100644 --- a/src/main/java/helma/framework/RequestBean.java +++ b/src/main/java/helma/framework/RequestBean.java @@ -16,12 +16,12 @@ package helma.framework; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.Serializable; import java.util.Map; /** - * + * */ public class RequestBean implements Serializable { private static final long serialVersionUID = -6826881712426326687L; @@ -89,7 +89,7 @@ public class RequestBean implements Serializable { * @return the header value, or null */ public String getHeader(String name) { - return req.getHeader(name); + return req.getHeader(name); } /** diff --git a/src/main/java/helma/framework/RequestTrans.java b/src/main/java/helma/framework/RequestTrans.java index 83665ba8..ec8218fe 100644 --- a/src/main/java/helma/framework/RequestTrans.java +++ b/src/main/java/helma/framework/RequestTrans.java @@ -19,9 +19,9 @@ package helma.framework; import helma.util.SystemMap; import helma.util.StringUtils; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.Cookie; import org.apache.commons.codec.binary.Base64; diff --git a/src/main/java/helma/framework/ResponseBean.java b/src/main/java/helma/framework/ResponseBean.java index 71688a96..a1a8c9fa 100644 --- a/src/main/java/helma/framework/ResponseBean.java +++ b/src/main/java/helma/framework/ResponseBean.java @@ -19,7 +19,7 @@ package helma.framework; import helma.objectmodel.db.Transactor; import helma.scripting.ScriptingException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.io.Serializable; import java.io.StringWriter; import java.io.PrintWriter; diff --git a/src/main/java/helma/framework/ResponseTrans.java b/src/main/java/helma/framework/ResponseTrans.java index 583b41b1..28fc3e65 100644 --- a/src/main/java/helma/framework/ResponseTrans.java +++ b/src/main/java/helma/framework/ResponseTrans.java @@ -21,7 +21,7 @@ import helma.framework.core.Application; import helma.util.*; import helma.scripting.ScriptingException; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletResponse; import java.io.*; import java.security.*; import java.util.*; diff --git a/src/main/java/helma/servlet/AbstractServletClient.java b/src/main/java/helma/servlet/AbstractServletClient.java index 77284078..561405b0 100644 --- a/src/main/java/helma/servlet/AbstractServletClient.java +++ b/src/main/java/helma/servlet/AbstractServletClient.java @@ -22,12 +22,14 @@ package helma.servlet; import helma.framework.*; import helma.framework.core.Application; import helma.util.*; + import java.io.*; import java.util.*; import java.security.SecureRandom; import java.security.NoSuchAlgorithmException; -import javax.servlet.*; -import javax.servlet.http.*; + +import jakarta.servlet.*; +import jakarta.servlet.http.*; import org.apache.commons.codec.binary.Base64; import org.apache.commons.fileupload.disk.DiskFileItemFactory; @@ -218,7 +220,7 @@ public abstract class AbstractServletClient extends HttpServlet { // read file uploads List uploads = null; - ServletRequestContext reqcx = new ServletRequestContext(request); + JakartaServletRequestContext reqcx = new JakartaServletRequestContext(request); if (ServletFileUpload.isMultipartContent(reqcx)) { // get session for upload progress monitoring @@ -653,7 +655,7 @@ public abstract class AbstractServletClient extends HttpServlet { map.put(name, newValues); } - protected List parseUploads(ServletRequestContext reqcx, RequestTrans reqtrans, + protected List parseUploads(JakartaServletRequestContext reqcx, RequestTrans reqtrans, final UploadStatus uploadStatus, String encoding) throws FileUploadException, UnsupportedEncodingException { // handle file upload diff --git a/src/main/java/helma/servlet/EmbeddedServletClient.java b/src/main/java/helma/servlet/EmbeddedServletClient.java index 80b3cd6e..9f9a37cc 100644 --- a/src/main/java/helma/servlet/EmbeddedServletClient.java +++ b/src/main/java/helma/servlet/EmbeddedServletClient.java @@ -19,7 +19,7 @@ package helma.servlet; import helma.framework.*; import helma.framework.core.Application; import helma.main.*; -import javax.servlet.*; +import jakarta.servlet.*; /** * Servlet client that runs a Helma application for the embedded diff --git a/src/main/java/helma/servlet/StandaloneServletClient.java b/src/main/java/helma/servlet/StandaloneServletClient.java index 5e1af952..bdfeeeae 100644 --- a/src/main/java/helma/servlet/StandaloneServletClient.java +++ b/src/main/java/helma/servlet/StandaloneServletClient.java @@ -23,7 +23,7 @@ import helma.main.ServerConfig; import helma.main.Server; import java.io.*; -import javax.servlet.*; +import jakarta.servlet.*; import java.util.*; /** @@ -98,7 +98,7 @@ public final class StandaloneServletClient extends AbstractServletClient { repositoryImpl = "helma.framework.repository.FileRepository"; } } - + try { Repository newRepository = (Repository) Class.forName(repositoryImpl) .getConstructor(parameters) @@ -116,7 +116,7 @@ public final class StandaloneServletClient extends AbstractServletClient { } } } - + // add app dir FileRepository appRep = new FileRepository(appDir); log("adding repository: " + appDir); From 90e45c91158978e649cad78ef02fdb3a51e35199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 15:46:19 +0200 Subject: [PATCH 14/39] Migrate to Apache file upload API 2 w/ Jakarta --- build.gradle | 3 +- .../helma/servlet/AbstractServletClient.java | 31 ++++++++++++------- src/main/java/helma/util/MimePart.java | 6 ++-- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 700545c0..0260b537 100644 --- a/build.gradle +++ b/build.gradle @@ -60,7 +60,8 @@ configurations { dependencies { implementation 'com.google.code.gson:gson:2.10.1' implementation 'commons-codec:commons-codec:1.17.0' - implementation 'commons-fileupload:commons-fileupload:1.5' + implementation 'org.apache.commons:commons-fileupload2-core:2.0.0-M2' + implementation 'org.apache.commons:commons-fileupload2-jakarta:2.0.0-M1' implementation 'commons-logging:commons-logging:1.3.2' implementation 'commons-net:commons-net:3.10.0' implementation 'com.sun.mail:javax.mail:1.6.2' diff --git a/src/main/java/helma/servlet/AbstractServletClient.java b/src/main/java/helma/servlet/AbstractServletClient.java index 561405b0..52d1a91d 100644 --- a/src/main/java/helma/servlet/AbstractServletClient.java +++ b/src/main/java/helma/servlet/AbstractServletClient.java @@ -24,18 +24,27 @@ import helma.framework.core.Application; import helma.util.*; import java.io.*; -import java.util.*; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; + import java.security.SecureRandom; import java.security.NoSuchAlgorithmException; +import java.util.*; import jakarta.servlet.*; import jakarta.servlet.http.*; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.fileupload.disk.DiskFileItemFactory; -import org.apache.commons.fileupload.*; -import org.apache.commons.fileupload.servlet.ServletFileUpload; -import org.apache.commons.fileupload.servlet.ServletRequestContext; + +import org.apache.commons.fileupload2.core.DiskFileItemFactory; +import org.apache.commons.fileupload2.core.FileItem; +import org.apache.commons.fileupload2.core.FileUploadException; +import org.apache.commons.fileupload2.core.FileUploadSizeException; +import org.apache.commons.fileupload2.core.ProgressListener; + +import org.apache.commons.fileupload2.jakarta.JakartaServletDiskFileUpload; +import org.apache.commons.fileupload2.jakarta.JakartaServletFileUpload; +import org.apache.commons.fileupload2.jakarta.JakartaServletRequestContext; /** * This is an abstract Hop servlet adapter. This class communicates with hop applications @@ -222,7 +231,7 @@ public abstract class AbstractServletClient extends HttpServlet { List uploads = null; JakartaServletRequestContext reqcx = new JakartaServletRequestContext(request); - if (ServletFileUpload.isMultipartContent(reqcx)) { + if (JakartaServletFileUpload.isMultipartContent(reqcx)) { // get session for upload progress monitoring UploadStatus uploadStatus = getApplication().getUploadStatus(reqtrans); try { @@ -230,7 +239,7 @@ public abstract class AbstractServletClient extends HttpServlet { } catch (Exception upx) { log("Error in file upload", upx); String message; - boolean tooLarge = (upx instanceof FileUploadBase.SizeLimitExceededException); + boolean tooLarge = (upx instanceof FileUploadSizeException); if (tooLarge) { message = "File upload size exceeds limit of " + uploadLimit + " kB"; } else { @@ -657,10 +666,10 @@ public abstract class AbstractServletClient extends HttpServlet { protected List parseUploads(JakartaServletRequestContext reqcx, RequestTrans reqtrans, final UploadStatus uploadStatus, String encoding) - throws FileUploadException, UnsupportedEncodingException { + throws FileUploadException, UnsupportedCharsetException, IOException { // handle file upload - DiskFileItemFactory factory = new DiskFileItemFactory(); - FileUpload upload = new FileUpload(factory); + DiskFileItemFactory factory = DiskFileItemFactory.builder().get(); + JakartaServletFileUpload upload = new JakartaServletFileUpload(factory); // use upload limit for individual file size, but also set a limit on overall size upload.setFileSizeMax(uploadLimit * 1024); upload.setSizeMax(totalUploadLimit * 1024); @@ -683,7 +692,7 @@ public abstract class AbstractServletClient extends HttpServlet { Object value; // check if this is an ordinary HTML form element or a file upload if (item.isFormField()) { - value = item.getString(encoding); + value = item.getString(Charset.forName(encoding)); } else { value = new MimePart(item); } diff --git a/src/main/java/helma/util/MimePart.java b/src/main/java/helma/util/MimePart.java index f69f1d61..e4ed29d8 100644 --- a/src/main/java/helma/util/MimePart.java +++ b/src/main/java/helma/util/MimePart.java @@ -16,7 +16,7 @@ package helma.util; -import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload2.core.FileItem; import java.io.*; import java.util.Date; @@ -238,7 +238,7 @@ public class MimePart implements Serializable { file = new File(base, filename); if (fileItem != null) { - fileItem.write(file); + fileItem.write(file.toPath()); // null out fileItem, since calling write() may have moved the temp file fileItem = null; } else { @@ -249,7 +249,7 @@ public class MimePart implements Serializable { // return file name return filename; } catch (Exception x) { - System.err.println("Error in MimePart.writeToFile(): " + x); + System.err.println("Error in MimePart.writeToFile(): " + x); return null; } } From 79d83389f21ef949eb7113bfef28206836707d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 16:16:04 +0200 Subject: [PATCH 15/39] Use canonical paths when creating static contexts --- src/main/java/helma/main/ApplicationManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 957eb7fe..7d31b764 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -483,7 +483,7 @@ public class ApplicationManager implements XmlRpcHandler { // if there is a static direcory specified, mount it if (this.staticDir != null) { - String staticPath = getAbsoluteFile(this.staticDir).getPath(); + String staticPath = getAbsoluteFile(this.staticDir).getCanonicalPath(); getLogger().info("Serving static from " + staticPath); getLogger().info("Mounting static at " + staticMountpoint); @@ -537,7 +537,7 @@ public class ApplicationManager implements XmlRpcHandler { } if (protectedStaticDir != null) { - String protectedContent = getAbsoluteFile(protectedStaticDir).getPath(); + String protectedContent = getAbsoluteFile(protectedStaticDir).getCanonicalPath(); appContext.setBaseResourceAsString(protectedContent); getLogger().info("Serving protected static from " + protectedContent); } From 9143faf35ec71163ebb9727daf6e1975602cc7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Thu, 30 May 2024 18:49:45 +0200 Subject: [PATCH 16/39] Add release action --- .github/workflows/release.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..28a2249c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build with Gradle + run: ./gradlew assembleDist + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "$GITHUB_REF_NAME" \ + --repo "$GITHUB_REPOSITORY" \ + --title "Helma $GITHUB_REF_NAME" \ + --generate-notes + + - name: Upload assets + run: | + gh release upload "$GITHUB_REF_NAME" \ + build/distributions/helma-*.* + --clobber From 9e870e6cd3cd189491d84af0c24367278b99f21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 12:23:03 +0200 Subject: [PATCH 17/39] Slightly modify the format of the build date --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7fbd71a4..050ca1c5 100644 --- a/build.gradle +++ b/build.gradle @@ -157,7 +157,7 @@ run { } task processSource(type: Sync) { - def date = new Date().format("MMMM dd, yyyy") + def date = new Date().format("d MMMM yyyy") def gitOutput = new ByteArrayOutputStream() exec { From 84abcde0370e9aa800bec7499c7fb95dce1c6f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 12:24:17 +0200 Subject: [PATCH 18/39] Update run configuration to always use the correct dependencies --- build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 050ca1c5..91a5ec0e 100644 --- a/build.gradle +++ b/build.gradle @@ -102,6 +102,8 @@ distributions { } application { + mainClass = 'helma.main.Server' + applicationDistribution.from(projectDir) { include 'modules/**' include 'LICENSE.md' @@ -152,8 +154,8 @@ installDist { } run { - classpath = files('launcher.jar') jvmArgs jettyLogLevel, suppressMacosDockIcon + classpath += fileTree(dir: 'lib/ext', include: '*.jar') } task processSource(type: Sync) { From ffb259a01c4626a30a9d3d5a3db505166fed7599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 12:37:16 +0200 Subject: [PATCH 19/39] Slightly modify the version string (still a date representation) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 91a5ec0e..0eef6f4d 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ allprojects { } } -version = new Date().format("yyyyMMdd") +version = new Date().format("yy.M.d") tasks.build.dependsOn javadoc, 'jsdoc', 'generateLicenseReport' tasks.compileJava.dependsOn 'processSource' From 45b19e32177b1fa8370093357af87d6a56da5039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 12:38:04 +0200 Subject: [PATCH 20/39] Reorder the tasks --- build.gradle | 56 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index 0eef6f4d..f1618a02 100644 --- a/build.gradle +++ b/build.gradle @@ -76,29 +76,9 @@ def rhinoJar = configurations.library.files.find { jar -> jar.name.startsWith('rhino') } -startScripts { - applicationName = 'helma' - classpath = files('../launcher.jar') - mainClass = 'helma.main.launcher.Main' - - defaultJvmOpts = [jettyLogLevel, suppressMacosDockIcon] - - doLast { - // Work-around to make the classpath above work (launcher.jar is located outside of `lib` dir) - // See https://discuss.gradle.org/t/classpath-in-application-plugin-is-building-always-relative-to-app-home-lib-directory/2012 - def unixScriptFile = file getUnixScript() - def windowsScriptFile = file getWindowsScript() - unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib', '$APP_HOME') - windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib', '%APP_HOME%') - } -} - -distributions { - main { - contents { - from project(':launcher').jar - } - } +run { + jvmArgs jettyLogLevel, suppressMacosDockIcon + classpath += fileTree(dir: 'lib/ext', include: '*.jar') } application { @@ -127,6 +107,31 @@ application { } } +startScripts { + applicationName = 'helma' + classpath = files('../launcher.jar') + mainClass = 'helma.main.launcher.Main' + + defaultJvmOpts = [jettyLogLevel, suppressMacosDockIcon] + + doLast { + // Work-around to make the classpath above work (launcher.jar is located outside of `lib` dir) + // See https://discuss.gradle.org/t/classpath-in-application-plugin-is-building-always-relative-to-app-home-lib-directory/2012 + def unixScriptFile = file getUnixScript() + def windowsScriptFile = file getWindowsScript() + unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib', '$APP_HOME') + windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib', '%APP_HOME%') + } +} + +distributions { + main { + contents { + from project(':launcher').jar + } + } +} + distTar { dependsOn ':generateLicenseReport', ':javadoc', ':jsdoc' @@ -153,11 +158,6 @@ installDist { } } -run { - jvmArgs jettyLogLevel, suppressMacosDockIcon - classpath += fileTree(dir: 'lib/ext', include: '*.jar') -} - task processSource(type: Sync) { def date = new Date().format("d MMMM yyyy") def gitOutput = new ByteArrayOutputStream() From 6401300189b40100d9e230adeff3cb7330409dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 13:02:11 +0200 Subject: [PATCH 21/39] Decouple update task from install Now that Gradle runs Helma with the configured dependencies, updating the installation directory has become less crucial --- README.md | 6 ++++-- build.gradle | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2a134485..e93af8d1 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,12 @@ Helma is built with [Gradle](https://gradle.org), the build task depends on the ### Additional Prerequisites -* [Rsync](https://rsync.samba.org) version ≥ 3.1.0 * [Node.js](https://nodejs.org) LTS version +* [Rsync](https://rsync.samba.org) version ≥ 3.1.0 -Clone this repository to your machine and start the build process with `./gradlew install`. The build script is going to ask you if you want to update the installation, enter `yes` or `no`. +Clone this repository to your machine and run Helma with `./gradlew run`. + +To update the installation from a build, run `./gradlew update` and enter `yes` at the prompt. > ⚠️ > Please be aware that this step is going to overwrite files in the installation directory – escpecially at a later time when there might be substantial changes. Should this happen by accident you find the previous installation in the `backups` directory. diff --git a/build.gradle b/build.gradle index f1618a02..e2ee6c4c 100644 --- a/build.gradle +++ b/build.gradle @@ -152,10 +152,6 @@ distZip { installDist { dependsOn build - - if (!System.getenv('CI')) { - finalizedBy 'update' - } } task processSource(type: Sync) { @@ -183,6 +179,8 @@ task processSource(type: Sync) { } task update { + dependsOn installDist + def rsyncArgs = ['--archive', '--filter', '- backups'] def confirm = { From 3e5af064b0e502820dcf4dea1a89d1c9bf0d2b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 14:59:33 +0200 Subject: [PATCH 22/39] Add setup for Gradle debugging in VS Codium --- .vscode/launch.json | 128 ++++++++++++++++---------------------------- .vscode/tasks.json | 66 +++++++++++++++++++++++ build.gradle | 8 +++ 3 files changed, 119 insertions(+), 83 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 8310c621..d1cf813f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,84 +1,46 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Current File", - "request": "launch", - "mainClass": "${file}" - }, - { - "type": "java", - "name": "ImageInfo", - "request": "launch", - "mainClass": "helma.image.ImageInfo", - "projectName": "helma_" - }, - { - "type": "java", - "name": "CommandlineRunner", - "request": "launch", - "mainClass": "helma.main.CommandlineRunner", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Server", - "request": "launch", - "mainClass": "helma.main.Server", - "projectName": "helma_" - }, - { - "type": "java", - "name": "XmlConverter", - "request": "launch", - "mainClass": "helma.objectmodel.dom.XmlConverter", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Crypt", - "request": "launch", - "mainClass": "helma.util.Crypt", - "projectName": "helma_" - }, - { - "type": "java", - "name": "HtmlEncoder", - "request": "launch", - "mainClass": "helma.util.HtmlEncoder", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Logo", - "request": "launch", - "mainClass": "helma.util.Logo", - "projectName": "helma_" - }, - { - "type": "java", - "name": "MarkdownProcessor", - "request": "launch", - "mainClass": "helma.util.MarkdownProcessor", - "projectName": "helma_" - }, - { - "type": "java", - "name": "Commandline", - "request": "launch", - "mainClass": "helma.main.launcher.Commandline", - "projectName": "launcher" - }, - { - "type": "java", - "name": "Main", - "request": "launch", - "mainClass": "helma.main.launcher.Main", - "projectName": "launcher" - } - ] -} \ No newline at end of file + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Current File", + "request": "launch", + "mainClass": "${file}" + }, + { + "type": "java", + "name": "Run with Gradle", + "request": "launch", + "mainClass": "helma.main.Server", + "projectName": "helma", + "preLaunchTask": "Run with Gradle", + "console": "internalConsole", + "stopOnEntry": false + }, + { + "name": "Debug with Gradle", + "type": "java", + "request": "attach", + "hostName": "localhost", + "port": 5005, + "preLaunchTask": "Debug with Gradle" + }, + { + "type": "java", + "name": "Commandline", + "request": "launch", + "mainClass": "helma.main.launcher.Commandline", + "projectName": "launcher" + }, + { + "type": "java", + "name": "Main", + "request": "launch", + "mainClass": "helma.main.launcher.Main", + "projectName": "launcher" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..78bedb1f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,66 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Run with Gradle", + "type": "shell", + "command": "./gradlew run", + "isBackground": true, + "group": { + "isDefault": true + }, + "problemMatcher": { + "owner": "java", + "fileLocation": "absolute", + "pattern": [ + { + // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) + "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", + "severity": 1, + "message": 2, + "file": 3, + "line": 4 + }, + { + // [2024/06/15 17:26:00] [INFO] [antville-1] INTERNAL:onStart done in 381 millis + "regexp": "^.+INTERNAL:onStart done in \\d+ millis", + "kind": "file", + "file": 0 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "^.+(INTERNAL):onStart done in \\d+ millis", + "endsPattern": "terminated with exit code" + } + } + }, + { + "label": "Debug with Gradle", + "type": "shell", + "command": "./gradlew debug", + "isBackground": true, + "problemMatcher": { + "owner": "custom", + "fileLocation": "absolute", + "pattern": [ + { + // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) + "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", + "severity": 1, + "message": 2, + "file": 3, + "line": 4 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": "Listening for transport dt_socket at address", + "endsPattern": "terminated with exit code" + } + } + } + ] +} diff --git a/build.gradle b/build.gradle index e2ee6c4c..84ef732e 100644 --- a/build.gradle +++ b/build.gradle @@ -290,3 +290,11 @@ task commandLine(type: JavaExec) { mainClass = 'helma.main.launcher.Commandline' args '-h', projectDir, function } + +tasks.register('debug', JavaExec) { + group = 'application' + main = 'helma.main.Server' + classpath = sourceSets.main.runtimeClasspath + jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'] + classpath += fileTree(dir: 'lib/ext', include: '*.jar') +} From 51bc14c3a456c3ff3247cbaae4e619d4b1bd30a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 18:01:30 +0200 Subject: [PATCH 23/39] Remove over-complicated launch and tasks configuration in favor of Gradle plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starting run/debug tasks with the plugin works out of the box; one just has to avoid the default “Run and Debug” button. --- .vscode/extensions.json | 3 +- .vscode/launch.json | 46 ---------------------------- .vscode/tasks.json | 66 ----------------------------------------- 3 files changed, 2 insertions(+), 113 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/tasks.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0d95f065..c52f6863 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,6 @@ { "recommendations": [ - "vscjava.vscode-java-pack" + "vscjava.vscode-java-pack", + "vscjava.vscode-gradle" ] } diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d1cf813f..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "java", - "name": "Current File", - "request": "launch", - "mainClass": "${file}" - }, - { - "type": "java", - "name": "Run with Gradle", - "request": "launch", - "mainClass": "helma.main.Server", - "projectName": "helma", - "preLaunchTask": "Run with Gradle", - "console": "internalConsole", - "stopOnEntry": false - }, - { - "name": "Debug with Gradle", - "type": "java", - "request": "attach", - "hostName": "localhost", - "port": 5005, - "preLaunchTask": "Debug with Gradle" - }, - { - "type": "java", - "name": "Commandline", - "request": "launch", - "mainClass": "helma.main.launcher.Commandline", - "projectName": "launcher" - }, - { - "type": "java", - "name": "Main", - "request": "launch", - "mainClass": "helma.main.launcher.Main", - "projectName": "launcher" - } - ] -} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 78bedb1f..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "Run with Gradle", - "type": "shell", - "command": "./gradlew run", - "isBackground": true, - "group": { - "isDefault": true - }, - "problemMatcher": { - "owner": "java", - "fileLocation": "absolute", - "pattern": [ - { - // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) - "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", - "severity": 1, - "message": 2, - "file": 3, - "line": 4 - }, - { - // [2024/06/15 17:26:00] [INFO] [antville-1] INTERNAL:onStart done in 381 millis - "regexp": "^.+INTERNAL:onStart done in \\d+ millis", - "kind": "file", - "file": 0 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "^.+(INTERNAL):onStart done in \\d+ millis", - "endsPattern": "terminated with exit code" - } - } - }, - { - "label": "Debug with Gradle", - "type": "shell", - "command": "./gradlew debug", - "isBackground": true, - "problemMatcher": { - "owner": "custom", - "fileLocation": "absolute", - "pattern": [ - { - // [2024/06/15 16:23:22] [ERROR] [antville-1] GET:main.css helma.scripting.ScriptingException: TypeError: Cannot find function getStaticFile in object HopObject Skin. (/home/tobi/Projects/helma/repo/./apps/antville/code/Site/Site.js#474) - "regexp": "^\\[.+\\] \\[(.+)\\] \\[.+\\] \\S+ \\s+: (.+) \\(([^#]+)#(\\d+)\\)$", - "severity": 1, - "message": 2, - "file": 3, - "line": 4 - } - ], - "background": { - "activeOnStart": true, - "beginsPattern": "Listening for transport dt_socket at address", - "endsPattern": "terminated with exit code" - } - } - } - ] -} From 19259162209ddd8abe8ae009cc0e808570d09cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 15 Jun 2024 18:27:30 +0200 Subject: [PATCH 24/39] Bump required minimum Java version to 17 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b1aa2021..94a72550 100644 --- a/build.gradle +++ b/build.gradle @@ -17,8 +17,8 @@ def textFiles = ['**/*.hac', '**/.html', '**/*.js', '**/*.md', '**/*.properties' allprojects { apply plugin: 'java' - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 repositories { mavenCentral() From de2150693f955b6e2c9f81f2012f5dcb7dd4cf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 21:42:33 +0100 Subject: [PATCH 25/39] Add deploy script usable with rsync and a restricted SSH key --- src/dist/extras/deploy.sh | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/dist/extras/deploy.sh diff --git a/src/dist/extras/deploy.sh b/src/dist/extras/deploy.sh new file mode 100644 index 00000000..6ebd6bf2 --- /dev/null +++ b/src/dist/extras/deploy.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# Use this script as forced command of an authorized SSH key: +# command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC… + +# Define HELMA_HOST and ANTVILLE_HOST in this file +# shellcheck source=/dev/null +. "$HOME"/deploy.env + +case "$SSH_ORIGINAL_COMMAND" in + ping) + echo pong + ;; + + deploy-helma) + rsync ./ "$HELMA_HOST":./ \ + --archive --compress --delete --verbose \ + --filter '+ /bin' \ + --filter '+ /extras' \ + --filter '+ /launcher.jar' \ + --filter '- /lib/ext' \ + --filter '+ /lib' \ + --filter '+ /modules' \ + --filter '- /*' + printf 'Restarting Helma on HELMA_host… ' + ssh "$HELMA_HOST" sudo /bin/systemctl restart helma + ;; + + deploy-antville) + rsync ./apps/antville/ "$ANTVILLE_HOST":./apps/antville/ \ + --archive --compress --delete --verbose \ + --filter '+ /claustra' \ + --filter '+ /code' \ + --filter '+ /compat' \ + --filter '+ /i18n' \ + --filter '+ /lib' \ + --filter '- /*' + rsync ./apps/antville/static/helma/ "$ANTVILLE_HOST":./apps/antville/static/helma/ \ + --archive --compress --verbose \ + --filter '+ /fonts' \ + --filter '+ /formica.html' \ + --filter '+ /img' \ + --filter '+ /scripts' \ + --filter '+ /styles' \ + --filter '- /*' + printf 'Restarting Helma on ANTVILLE_host… ' + ssh "$ANTVILLE_HOST" sudo /bin/systemctl restart helma + ;; + + restart) + printf 'Restarting Helma… ' + sudo /bin/systemctl restart helma + printf '%s\n' 'done.' + ;; + + *) + # Allow any rsync command but restrict it to the installation directory + rrsync -wo /home/helma + ;; +esac From a3fbf72f3855cfa0c69919d126c9661f985e0f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 21:58:08 +0100 Subject: [PATCH 26/39] Initial commit --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..9bf8429b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build + +on: + push: + paths: + - build.gradle + - settings.gradle + - src/** + - launcher/build.gradle + - launcher/src/** + workflow_dispatch: + +jobs: + build: + runs-on: antville + + strategy: + matrix: + java: [11, 17, 21] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.java }} + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Compile with Gradle + run: ./gradlew :compileJava From bc7894ecc19c54fe91967927c7c2e26180b2c3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 22:04:48 +0100 Subject: [PATCH 27/39] Use fully qualified URL for setup-java action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bf8429b..18fde086 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v4 + uses: https://github.com/actions/setup-java@v4 with: distribution: temurin java-version: ${{ matrix.java }} From 4c011f1e1baf35a273add96b4574064995ca59bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 22:09:55 +0100 Subject: [PATCH 28/39] Gradle is installed on the runner --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18fde086..846e2d6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,5 @@ jobs: distribution: temurin java-version: ${{ matrix.java }} - - name: Set up Gradle - uses: gradle/actions/setup-gradle@v3 - - name: Compile with Gradle run: ./gradlew :compileJava From 04b210b464dccb56edb598321ca594a78972913d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 22:12:30 +0100 Subject: [PATCH 29/39] Leave aside compiling for different Java versions for now --- .github/workflows/build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 846e2d6f..47af9523 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,18 +14,8 @@ jobs: build: runs-on: antville - strategy: - matrix: - java: [11, 17, 21] - steps: - uses: actions/checkout@v4 - - name: Set up Java - uses: https://github.com/actions/setup-java@v4 - with: - distribution: temurin - java-version: ${{ matrix.java }} - - name: Compile with Gradle run: ./gradlew :compileJava From 9b5cc988ddf3ec06d5dd71d6b0053a6649ea9059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Fri, 28 Feb 2025 22:13:25 +0100 Subject: [PATCH 30/39] Run the build workflow when itself has changed --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47af9523..69bcdeab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build on: push: paths: + - .github/workflows/build.yml - build.gradle - settings.gradle - src/** From 6fc73d2320afcd4711b17ba9d7262e5df1ff00f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 1 Mar 2025 01:02:27 +0100 Subject: [PATCH 31/39] Add release notes generated with git-cliff --- .github/workflows/release.yml | 23 ++++++++++++---- cliff.toml | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 cliff.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7aa7874..ac8a3d1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,16 +9,27 @@ permissions: contents: write jobs: - build: + release: runs-on: antville env: GH_TOKEN: ${{ secrets.GH_TOKEN }} LC_TIME: en_US.UTF-8 - TODAY: $(date +'%d %b %Y') steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create release notes + id: create_release_notes + run: | + release_notes=$(npx git-cliff@latest --latest) + # Write the release notes as a heredoc to the workflow output + # ⚠️ No white space around `<<` is crucial! + echo "release_notes<<.eot0x03" >> $GITHUB_OUTPUT + echo "$release_notes" >> $GITHUB_OUTPUT + echo ".eot0x03" >> $GITHUB_OUTPUT - name: Build with Gradle run: ./gradlew assembleDist @@ -29,17 +40,17 @@ jobs: direction: upload url: https://code.host.antville.org token: ${{ github.token }} - title: ${{ env.TODAY }} + title: Helma ${{ github.ref_name }} release-dir: build/distributions - release-notes-assistant: true + release-notes: ${{ steps.create_release_notes.outputs.release_notes }} verbose: true - name: Create release at GitHub run: | gh release create "$GITHUB_REF_NAME" \ --repo "$GITHUB_REPOSITORY" \ - --title "${{ env.TODAY }}" \ - --generate-notes + --title "Helma ${{ github.ref_name }}" \ + --notes "${{ steps.create_release_notes.outputs.release_notes }}" - name: Upload release assets to GitHub run: | diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 00000000..7832044a --- /dev/null +++ b/cliff.toml @@ -0,0 +1,52 @@ +# git-cliff ~ default configuration file +# https://git-cliff.org/docs/configuration +# +# Lines starting with "#" are comments. +# Configuration options are organized into tables and keys. +# See documentation for more information on available options. + +[changelog] +trim = true + +header = "## Changes" + +body = """ +{% for group, commits in commits | filter(attribute="merge_commit") | group_by(attribute="group") %} + ### {{ group | striptags | trim | upper_first }} + {% for commit in commits %} + * [{{ commit.id | split(pat="") | slice(end=11) | join() }}]\ + (https://code.host.antville.org/antville/helma/commit/{{ commit.id }}) \ + {% if commit.breaking %}**Breaking:** {% endif %}\ + {{ commit.message | split(pat="\\n") | first | upper_first }}\ + {% endfor %} +{% endfor %} + +**Full Changelog:** [{{ previous.version }} → {{ version }}]\ +(https://code.host.antville.org/antville/helma/compare/\ +{{ previous.version | urlencode }}..{{ version | urlencode }})\n\n +""" + +footer = """ +Generated by [git-cliff](https://git-cliff.org/). +""" + +[git] +conventional_commits = false +filter_commits = false +filter_unconventional = false +protect_breaking_commits = false +sort_commits = "newest" +split_commits = false +topo_order = false + +commit_parsers = [ + { message = "^Apply \\d+ suggestion", skip = true }, + { message = "^Merge .*(branch|dependabot|dependency|renovate)", skip = true }, + { message = "^Lock file maintenance", skip = true }, + { message = "yarn\\.lock", skip = true }, + + { message = "^[Ff]ix", group = " 🐛 Bug Fixes" }, + { field = "author.name", pattern = "[Rr]enovate|[Dd]ependabot", group = " 📦 Dependency Updates" }, + { message = "^Merge pull request", group = " 🔀 Merges" }, + { message = ".*", group = " Uncategorized" }, +] From fc084f6e525e41b20b0c4bbfe002972aa8d3c80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 1 Mar 2025 19:21:42 +0100 Subject: [PATCH 32/39] Escape HTML elements in commit messages --- cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cliff.toml b/cliff.toml index 7832044a..755c4ca2 100644 --- a/cliff.toml +++ b/cliff.toml @@ -17,7 +17,7 @@ body = """ * [{{ commit.id | split(pat="") | slice(end=11) | join() }}]\ (https://code.host.antville.org/antville/helma/commit/{{ commit.id }}) \ {% if commit.breaking %}**Breaking:** {% endif %}\ - {{ commit.message | split(pat="\\n") | first | upper_first }}\ + {{ commit.message | split(pat="\\n") | first | upper_first | escape }}\ {% endfor %} {% endfor %} From b7543cf6157b3603bbdf79a61013a6c9d53adb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 1 Mar 2025 19:32:06 +0100 Subject: [PATCH 33/39] Bump year of copyright notice --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index df5926e7..65dfb884 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 1999-2008 Helma Project. All rights reserved. +Copyright (c) 1999-2025 Helma Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions From c42c0a7a17758a06f4f36e83cbb959cbb2dd1b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 1 Mar 2025 19:32:20 +0100 Subject: [PATCH 34/39] Update repo URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e93af8d1..f8155df0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## TL;DR - Make sure you have Java 11 or higher installed -- Download and unpack the [latest release](https://github.com/antville/helma/releases) +- Download and unpack the [latest release](https://code.host.antville.org/antville/helma/releases) - Invoke `./bin/helma`, resp. `./bin/helma.bat`, depending on your platform - Direct your web browser to From 99e8b204fd02c6278bb7f6f0fc0644828f6c3f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Mon, 7 Apr 2025 01:01:19 +0200 Subject: [PATCH 35/39] Bump Java version --- .java-version | 2 +- README.md | 2 +- src/main/java/helma/main/Server.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.java-version b/.java-version index 3b5b5d8f..98d9bcb7 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -11.0 \ No newline at end of file +17 diff --git a/README.md b/README.md index f8155df0..f6438677 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## TL;DR -- Make sure you have Java 11 or higher installed +- Make sure you have Java 17 or higher installed - Download and unpack the [latest release](https://code.host.antville.org/antville/helma/releases) - Invoke `./bin/helma`, resp. `./bin/helma.bat`, depending on your platform - Direct your web browser to diff --git a/src/main/java/helma/main/Server.java b/src/main/java/helma/main/Server.java index 88d70db7..d951adae 100644 --- a/src/main/java/helma/main/Server.java +++ b/src/main/java/helma/main/Server.java @@ -21,6 +21,7 @@ import helma.framework.repository.FileResource; import helma.framework.core.*; import helma.objectmodel.db.DbSource; import helma.util.*; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.xmlrpc.*; @@ -152,8 +153,8 @@ public class Server implements Runnable { String javaVersion = System.getProperty("java.version", "0"); int majorVersion = Integer.parseInt(javaVersion.split("\\.")[0]); - if (majorVersion < 11) { - System.err.println("This version of Helma requires Java 11 or greater."); + if (majorVersion < 17) { + System.err.println("This version of Helma requires Java 17 or greater."); if (majorVersion == 0) { // don't think this will ever happen, but you never know System.err.println("Your Java Runtime did not provide a version number. Please update to a more recent version."); From 2994a4becc41c97707bda88e08f64e3f8379da2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Mon, 7 Apr 2025 01:06:09 +0200 Subject: [PATCH 36/39] =?UTF-8?q?Disable=20Jetty=E2=80=99s=20session=20coo?= =?UTF-8?q?kies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This remediates the exception “Shared scheduler not started” and restores the functionality of enabling an app in apps.properties – see https://code.host.antville.org/antville/helma/pulls/103#issuecomment-1825 --- src/main/java/helma/main/ApplicationManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 7d31b764..02affa2d 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -502,7 +502,9 @@ public class ApplicationManager implements XmlRpcHandler { staticContext.start(); } - appContext = new ServletContextHandler(ServletContextHandler.SESSIONS); + // I hope I am correct assuming Helma does not need Jetty’s session management, but using + // `ServletContextHandler.SESSIONS` causes an exception: Shared scheduler not started + appContext = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); appContext.setContextPath(pathPattern); context.addHandler(appContext); @@ -544,9 +546,7 @@ public class ApplicationManager implements XmlRpcHandler { // Remap the context paths and start ApplicationManager.this.context.mapContexts(); - // FIXME: Causing java.lang.IllegalStateException: Shared scheduler not started - // Is it necessary, anway? - //this.appContext.start(); + this.appContext.start(); } // register as XML-RPC handler From 36a12effb2ada1f5efe8ab60c35a80dc9e97dac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Mon, 7 Apr 2025 16:56:05 +0200 Subject: [PATCH 37/39] Bump Jetty versions to 12.0.19 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 84d471ed..d5f86709 100644 --- a/build.gradle +++ b/build.gradle @@ -67,8 +67,8 @@ dependencies { implementation 'com.sun.mail:javax.mail:1.6.2' implementation 'jakarta.servlet:jakarta.servlet-api:5.0.0' implementation 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' - implementation 'org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.9' - implementation 'org.eclipse.jetty:jetty-xml:12.0.9' + implementation 'org.eclipse.jetty.ee9:jetty-ee9-servlet:12.0.19' + implementation 'org.eclipse.jetty:jetty-xml:12.0.19' implementation 'org.mozilla:rhino-all:1.8.0' implementation 'org.sejda.imageio:webp-imageio:0.1.6' implementation 'xerces:xercesImpl:2.12.2' From 436862e87a941c4a6f0152d580e650ce1474b61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Mon, 7 Apr 2025 16:58:35 +0200 Subject: [PATCH 38/39] =?UTF-8?q?Remove=20setting=20of=20=E2=80=9Cempty?= =?UTF-8?q?=E2=80=9D=20base=20resource?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fingers crossed it won’t be missed --- src/main/java/helma/main/ApplicationManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 02affa2d..17915987 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -494,8 +494,6 @@ public class ApplicationManager implements XmlRpcHandler { ContextHandler staticContext = new ContextHandler(); staticContext.setContextPath(staticMountpoint); - // FIXME: Causing java.lang.IllegalArgumentException: Resource String is invalid - //staticContext.setBaseResourceAsString(""); staticContext.setHandler(rhandler); ApplicationManager.this.context.addHandler(staticContext); From 6723df912e671f5f7da4963c40358e2ae549c271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Mon, 7 Apr 2025 17:02:11 +0200 Subject: [PATCH 39/39] Resolve FIXME but without fixing the issue I tried to make this work but it might need a more thorough rewrite that I just cannot do. The worst that can happen is stopping and starting Helma apps adding redundant ServletContextHandlers to the ContextHandlerCollection until Helma is restarted. --- src/main/java/helma/main/ApplicationManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/helma/main/ApplicationManager.java b/src/main/java/helma/main/ApplicationManager.java index 17915987..e699a8d8 100644 --- a/src/main/java/helma/main/ApplicationManager.java +++ b/src/main/java/helma/main/ApplicationManager.java @@ -563,8 +563,8 @@ public class ApplicationManager implements XmlRpcHandler { // unbind from Jetty HTTP server if (ApplicationManager.this.jetty != null) { if (this.appContext != null) { - // FIXME: Causing incompatible types: ServletContextHandler cannot be converted to Handler - // Is it necessary, anyway? + // Adding appContext to the ContextHandlerCollection works (see above) but removing it causes an exception of + // incompatible types: ServletContextHandler cannot be converted to Handler //ApplicationManager.this.context.removeHandler(this.appContext); this.appContext.stop(); this.appContext.destroy();