- all servletmodules and all modules now use log4j for logging
[mir.git] / source / mir / servlet / ServletModule.java
index d15b61d..9cb9564 100755 (executable)
@@ -36,6 +36,7 @@ import freemarker.template.TemplateModelRoot;
 import freemarker.template.TemplateModel;
 
 import mir.entity.EntityList;
+import mir.log.*;
 import mir.misc.*;
 import mir.module.AbstractModule;
 import mir.module.ModuleException;
@@ -68,7 +69,8 @@ import java.util.Locale;
 public abstract class ServletModule {
 
     public String defaultAction;
-    protected Logfile theLog;
+    protected LoggerWrapper logger;
+
     protected AbstractModule mainModule;
     protected String templateListString;
     protected String templateObjektString;
@@ -116,6 +118,14 @@ public abstract class ServletModule {
     public void process(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {
     }
 
+    public void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleException {
+      try {
+        aResponse.sendRedirect(MirConfig.getProp("RootUri") + "/Mir?"+aQuery);
+      }
+      catch (Throwable t) {
+        throw new ServletModuleException(t.getMessage());
+      }
+    }
 
     /**
      *  list(req,res) - generische Listmethode. Wennn die Funktionalitaet
@@ -192,9 +202,9 @@ public abstract class ServletModule {
             throws ServletModuleException, ServletModuleUserException {
         try {
             HashMap withValues = getIntersectingValues(req, mainModule.getStorageObject());
-            theLog.printDebugInfo("--trying to add...");
+            logger.debug("--trying to add...");
             String id = mainModule.add(withValues);
-            theLog.printDebugInfo("--trying to deliver..." + id);
+            logger.debug("--trying to deliver..." + id);
             list(req, res);
         }
         catch (Exception e) {