simplify Jetty related code by removing web fragment content support
authorMichael Vorburger <mike@vorburger.ch>
Wed, 7 Feb 2018 20:32:29 +0000 (21:32 +0100)
committerMichael Vorburger <mike@vorburger.ch>
Wed, 1 Jul 2020 23:30:15 +0000 (01:30 +0200)
the WEB_TAG_FILE thing for static web content in JARs which I
implemented many (many) moons ago is not required anymore for what I'm
after here, so remove that and simplify.

Signed-off-by: Michael Vorburger <mike@vorburger.ch>
src/main/java/org/opendaylight/infrautils/simple/jetty/JettyLauncher.java

index 6783dc1e45bfd749364826bdaee61981762dfaaa..41542993fe0722acd281240bdccfd91f8cf15462 100644 (file)
@@ -14,7 +14,6 @@ import java.net.URL;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.LinkedList;
-import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Singleton;
@@ -22,7 +21,6 @@ import org.eclipse.jetty.jmx.MBeanContainer;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.resource.ResourceCollection;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -71,7 +69,7 @@ public class JettyLauncher {
         webApp.setContextPath("/test");
 
         // TODO LOG.info baseResource, with context..
-        webApp.setBaseResource(baseResources());
+        webApp.setBaseResource(chop(webXmlUrl(), WEB_INF_WEB_XML));
         LOG.info("webApp.getWebInf() = {}", webApp.getWebInf());
         // TODO not needed? webApp.setDescriptor("WEB-INF/web.xml");
         // TODO or? webApp.setDescriptor(JettyLauncher.class.getResource("/WEB-INF/web.xml").toString());
@@ -102,16 +100,6 @@ public class JettyLauncher {
     // and http://blog2.vorburger.ch/2015/03/mifos-standalone-package-how-to.html
     // and http://blog2.vorburger.ch/2014/09/mifos-executable-war-with-mariadb4j.html
 
-    private ResourceCollection baseResources() throws IOException, MalformedURLException {
-        final List<Resource> webResourceModules = new LinkedList<>();
-        webResourceModules.add(chop(webXmlUrl(), WEB_INF_WEB_XML));
-//        final Collection<URL> webTagURLs = getResources(WEB_TAG_FILE);
-//        for (final URL webTagFileURL : webTagURLs) {
-//            webResourceModules.add(chop(webTagFileURL, WEB_TAG_FILE));
-//        }
-        return new ResourceCollection(webResourceModules.toArray(new Resource[webResourceModules.size()]));
-    }
-
     private Resource chop(final URL baseURL, String toChop) throws MalformedURLException, IOException {
         String base = baseURL.toExternalForm();
         if (!base.endsWith(toChop)) {