From 8a8152eebc30f4efe8e8e40ba51f46b775476674 Mon Sep 17 00:00:00 2001 From: ulrich <not disclosed> Date: Sun, 04 Mar 2018 14:16:25 +0000 Subject: [PATCH] Bildqualitaet hinzugefuegt --- src/java/de/uhilger/filecms/web/Initialiser.java | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/src/java/de/uhilger/filecms/web/Initialiser.java b/src/java/de/uhilger/filecms/web/Initialiser.java index eece13c..cda0ec7 100644 --- a/src/java/de/uhilger/filecms/web/Initialiser.java +++ b/src/java/de/uhilger/filecms/web/Initialiser.java @@ -19,10 +19,13 @@ package de.uhilger.filecms.web; import java.io.File; +import java.io.IOException; +import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; +import org.apache.commons.io.FileUtils; /** * Initialisieren der Dateiverwaltung @@ -99,11 +102,34 @@ ctx.setAttribute(FILE_BASE, getWbxDataDir(ctx).getAbsolutePath()); } } + + protected void ablageInitialisieren(ServletContext ctx) { + Object o = ctx.getAttribute(FILE_BASE); + if(o instanceof String) { + String targetDirName = (String) o; + File dataDir = new File(targetDirName, "www"); + if(!dataDir.exists()) { + String srcPath = ctx.getRealPath("/"); // file-cms in webapps + File srcDir = new File(srcPath, "/META-INF/daten/www"); + dataDir = new File(targetDirName); + try { + FileUtils.copyDirectoryToDirectory(srcDir, dataDir); + srcDir = new File(srcPath, "/META-INF/daten/home"); + FileUtils.copyDirectoryToDirectory(srcDir, dataDir); + srcDir = new File(srcPath, "/META-INF/daten/dav"); + FileUtils.copyDirectoryToDirectory(srcDir, dataDir); + } catch (IOException ex) { + logger.log(Level.SEVERE, null, ex); + } + } + } + } @Override public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); ablageErmitteln(ctx); + ablageInitialisieren(ctx); } @Override -- Gitblit v1.9.3