From 15dfd13576538a1446d30b7fa8fc03f5daf5e909 Mon Sep 17 00:00:00 2001 From: Rainer Prosi Date: Mon, 10 Jun 2024 21:30:00 +0200 Subject: [PATCH 1/4] ensure backwards compatibility of jettyserver --- .../cip4/jdfutility/server/JettyServer.java | 21 ++++++++++++++++++- .../jdfutility/server/JettyServerTest.java | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cip4/jdfutility/server/JettyServer.java b/src/main/java/org/cip4/jdfutility/server/JettyServer.java index 5b62af6..3d5fa62 100644 --- a/src/main/java/org/cip4/jdfutility/server/JettyServer.java +++ b/src/main/java/org/cip4/jdfutility/server/JettyServer.java @@ -265,6 +265,7 @@ public void setSSLPort(final int port) /** * @param port the ssl port * @return may be used for additional setup + * @deprecated use the single argument version */ @Deprecated public void setSSLPort(final int port, final String dummy) @@ -494,11 +495,29 @@ public void handle(final String pathInContext, final Request arg1, final HttpSer */ protected ResourceHandler createResourceHandler() { - final ResourceHandler resourceHandler = new MyResourceHandler(context, getHome()); + final ResourceHandler resourceHandler = new org.cip4.jdfutility.server.MyResourceHandler(context, getHome()); resourceHandler.setResourceBase("."); return resourceHandler; } + /** + * simple resource (file) handler that tweeks the url to match the context, thus allowing servlets to emulate a war file without actually requiring the war file + * + * @author rainer prosi + * @date Dec 10, 2010 + * @deprecated use superclass + */ + @Deprecated + public class MyResourceHandler extends org.cip4.jdfutility.server.MyResourceHandler + { + + public MyResourceHandler(final String strip) + { + super(strip, null); + } + + } + /** * @return the home url, e.g. "."+context+"/overview" */ diff --git a/src/test/java/org/cip4/jdfutility/server/JettyServerTest.java b/src/test/java/org/cip4/jdfutility/server/JettyServerTest.java index a1b54cd..269b102 100644 --- a/src/test/java/org/cip4/jdfutility/server/JettyServerTest.java +++ b/src/test/java/org/cip4/jdfutility/server/JettyServerTest.java @@ -48,7 +48,7 @@ import org.cip4.jdfutility.server.JettyServer.JettySSLData; import org.junit.jupiter.api.Test; -public class JettyServerTest extends JDFUtilityTestBase +class JettyServerTest extends JDFUtilityTestBase { static volatile int PORT = 33666; From ca5996873ff272e4f7c3c0fe7e0ba26962573aa3 Mon Sep 17 00:00:00 2001 From: Rainer Prosi Date: Tue, 11 Jun 2024 15:25:56 +0200 Subject: [PATCH 2/4] cleanup of resource handler --- .../cip4/jdfutility/server/JettyServer.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/main/java/org/cip4/jdfutility/server/JettyServer.java b/src/main/java/org/cip4/jdfutility/server/JettyServer.java index 3d5fa62..b6f4708 100644 --- a/src/main/java/org/cip4/jdfutility/server/JettyServer.java +++ b/src/main/java/org/cip4/jdfutility/server/JettyServer.java @@ -495,29 +495,11 @@ public void handle(final String pathInContext, final Request arg1, final HttpSer */ protected ResourceHandler createResourceHandler() { - final ResourceHandler resourceHandler = new org.cip4.jdfutility.server.MyResourceHandler(context, getHome()); + final ResourceHandler resourceHandler = new MyResourceHandler(context, getHome()); resourceHandler.setResourceBase("."); return resourceHandler; } - /** - * simple resource (file) handler that tweeks the url to match the context, thus allowing servlets to emulate a war file without actually requiring the war file - * - * @author rainer prosi - * @date Dec 10, 2010 - * @deprecated use superclass - */ - @Deprecated - public class MyResourceHandler extends org.cip4.jdfutility.server.MyResourceHandler - { - - public MyResourceHandler(final String strip) - { - super(strip, null); - } - - } - /** * @return the home url, e.g. "."+context+"/overview" */ From 3e2b19a572f520ef8f7bf15acc5d560c25877d46 Mon Sep 17 00:00:00 2001 From: Rainer Prosi Date: Wed, 12 Jun 2024 16:37:09 +0200 Subject: [PATCH 3/4] we do need the backwards compatible thingy --- .../org/cip4/jdfutility/server/JettyServer.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cip4/jdfutility/server/JettyServer.java b/src/main/java/org/cip4/jdfutility/server/JettyServer.java index b6f4708..28ae701 100644 --- a/src/main/java/org/cip4/jdfutility/server/JettyServer.java +++ b/src/main/java/org/cip4/jdfutility/server/JettyServer.java @@ -490,12 +490,25 @@ public void handle(final String pathInContext, final Request arg1, final HttpSer } } + /** + * @author rainer prosi + */ + public class MyResourceHandler extends org.cip4.jdfutility.server.MyResourceHandler + { + + public MyResourceHandler(final String strip) + { + super(strip, getHome()); + } + + } + /** * @return */ protected ResourceHandler createResourceHandler() { - final ResourceHandler resourceHandler = new MyResourceHandler(context, getHome()); + final ResourceHandler resourceHandler = new org.cip4.jdfutility.server.MyResourceHandler(context, getHome()); resourceHandler.setResourceBase("."); return resourceHandler; } From cc16159e0584b1307f9b4cfd74c45e5ffc0a4031 Mon Sep 17 00:00:00 2001 From: Rainer Prosi Date: Fri, 14 Jun 2024 12:41:28 +0200 Subject: [PATCH 4/4] disable directory listings --- src/main/java/org/cip4/jdfutility/server/JettyServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/cip4/jdfutility/server/JettyServer.java b/src/main/java/org/cip4/jdfutility/server/JettyServer.java index 28ae701..96c0e3c 100644 --- a/src/main/java/org/cip4/jdfutility/server/JettyServer.java +++ b/src/main/java/org/cip4/jdfutility/server/JettyServer.java @@ -510,6 +510,7 @@ protected ResourceHandler createResourceHandler() { final ResourceHandler resourceHandler = new org.cip4.jdfutility.server.MyResourceHandler(context, getHome()); resourceHandler.setResourceBase("."); + resourceHandler.setDirAllowed(false); return resourceHandler; }