From ba4405e05bb3f6ec43157b0c40cfe3609e5196b9 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Sun, 24 Jul 2022 21:31:30 -0500 Subject: [PATCH] Comment/TODO updates for Jetty 12.0.x from review with @gregw --- .../main/java/org/eclipse/jetty/server/ResourceService.java | 1 + .../org/eclipse/jetty/server/handler/ResourceHandlerTest.java | 4 ++-- .../org/eclipse/jetty/ee10/servlet/ServletContextHandler.java | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java index a76d520bb58..fd3e0efbd2e 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceService.java @@ -443,6 +443,7 @@ public class ResourceService } case SERVE -> { + // TODO : check conditional headers. // TODO output buffer size???? HttpContent c = _contentFactory.getContent(welcomeAction.target, 16 * 1024); sendData(request, response, callback, c, null); diff --git a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java index fc8fff6daa0..b12f500fa82 100644 --- a/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java +++ b/jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java @@ -3261,7 +3261,7 @@ public class ResourceHandlerTest ContextHandler altContext = new ContextHandler("/context/alt"); altContext.setHandler(altResourceHandler); _contextHandlerCollection.addHandler(altContext); - altContext.start(); // TODO: do we really need to start this on our own? + altContext.start(); // Correct behavior, after ContextHandlerCollection is started, it's on us to start the handler. ResourceHandler otherResourceHandler = new ResourceHandler(); otherResourceHandler.setBaseResource(Resource.newResource(altRoot)); @@ -3271,7 +3271,7 @@ public class ResourceHandlerTest ContextHandler otherContext = new ContextHandler("/context/other"); otherContext.setHandler(otherResourceHandler); _contextHandlerCollection.addHandler(otherContext); - otherContext.start(); // TODO: do we really need to start this on our own? + otherContext.start(); // Correct behavior, after ContextHandlerCollection is started, it's on us to start the handler. _rootResourceHandler.setDirAllowed(false); _rootResourceHandler.setRedirectWelcome(false); diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java index 190d745884f..e736c3eeffe 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java @@ -2938,6 +2938,9 @@ public class ServletContextHandler extends ContextHandler implements Graceful @Override public ServletContext getContext(String uripath) { + // TODO: should we throw UnsupportedOperationException here? + // This is a change in API from Jetty 10 and Jetty 11, as the older Jetty versions goes down to ContextHandler. + // Also, how do we handle cross context across EE environments? List contexts = new ArrayList<>(); List handlers = getServer().getDescendants(ServletContextHandler.class); String matchedPath = null;