diff gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java @ 9747:cfc0aab9947f 3.2.x

Enable bind-mounting client configuration in docker container
author Tom Gottfried <tom@intevation.de>
date Mon, 05 Sep 2022 17:55:32 +0200
parents 0a5239a1e46e
children
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java	Tue Aug 30 15:02:10 2022 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/BaseServletContextListener.java	Mon Sep 05 17:55:32 2022 +0200
@@ -8,6 +8,7 @@
 
 package org.dive4elements.river.client.server;
 
+import java.io.File;
 import java.io.IOException;
 
 import javax.servlet.ServletContext;
@@ -33,12 +34,14 @@
     public void  contextInitialized(ServletContextEvent sce) {
         ServletContext sc = sce.getServletContext();
 
-        String filename = sc.getInitParameter("features-file");
+        File file = new File(sc.getInitParameter("features-file"));
+        String path = file.isAbsolute()
+            ? file.getPath()
+            : sc.getRealPath(file.getPath());
 
         log.debug("Initializing ServletContext");
         try {
-            XMLFileFeatures features = new XMLFileFeatures(
-                sc.getRealPath(filename));
+            XMLFileFeatures features = new XMLFileFeatures(path);
             sc.setAttribute(Features.CONTEXT_ATTRIBUTE, features);
         } catch(IOException e) {
             log.error(e);

http://dive4elements.wald.intevation.org