budfixx
authoridfx <idfx>
Mon, 10 Sep 2001 22:07:50 +0000 (22:07 +0000)
committeridfx <idfx>
Mon, 10 Sep 2001 22:07:50 +0000 (22:07 +0000)
source/OpenMir.java

index cf4854e..fe9e1c9 100755 (executable)
@@ -26,57 +26,59 @@ import mircoders.storage.*;
 
 public class OpenMir extends AbstractServlet
 {
-       private static Logfile                theLog;
-       private static boolean                confed=false;
-       private static String   lang;
+  private static Logfile                theLog;
+  private static boolean                confed=false;
+  private static String lang;
+  public HttpSession session;
 
-       public void doGet(HttpServletRequest req, HttpServletResponse res)
-               throws ServletException, IOException {
-               doPost(req,res);
-       }
+  public void doGet(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
+    doPost(req,res);
+  }
 
-       public void doPost(HttpServletRequest req, HttpServletResponse res)
-               throws ServletException, IOException {
+  public void doPost(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
 
-               long            startTime = (new java.util.Date()).getTime();
-               long            sessionConnectTime=0;
+    long            startTime = (new java.util.Date()).getTime();
+    long            sessionConnectTime=0;
 
+    session = req.getSession(true);
+    
     if (!confed){
       confed = getConfig(req);
     }
-
-               HttpSession session = req.getSession(true);
+      
     if(session.getAttribute("Language")==null){
-      setLanguage(req,getAcceptLanguage(req));
+      setLanguage(session,getAcceptLanguage(req));
+    }
+
+    res.setContentType("text/html");
+    try {
+      ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res);
     }
+    catch (ServletModuleException e){ handleError(res,res.getWriter(), "OpenIndy :: ServletException in Module ServletModule -- " + e.toString()); }
+    // timing...
+    sessionConnectTime = new java.util.Date().getTime() - startTime;
+    theLog.printInfo("EXECTIME (ServletModuleOpenIndy): " + sessionConnectTime + " ms");
+  }
+
+  private void handleError(HttpServletResponse res,PrintWriter out, String errorString) {
+
+    try {
+      theLog.printError(errorString);
+      SimpleHash modelRoot = new SimpleHash();
+      modelRoot.put("errorstring", new SimpleScalar(errorString));
+      modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
+      HTMLTemplateProcessor.process(res,Configuration.getProperty("Mir.ErrorTemplate"),modelRoot,out);
+      out.close();
+    }
+    catch (Exception e) {
+      System.err.println("Fehler in ErrorTemplate");
+    }
+
+  }
 
-               res.setContentType("text/html");
-               try {
-                       ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res);
-               }
-               catch (ServletModuleException e){ handleError(res,res.getWriter(), "OpenIndy :: ServletException in Module ServletModule -- " + e.toString()); }
-               // timing...
-               sessionConnectTime = new java.util.Date().getTime() - startTime;
-               theLog.printInfo("EXECTIME (ServletModuleOpenIndy): " + sessionConnectTime + " ms");
-       }
-
-       private void handleError(HttpServletResponse res,PrintWriter out, String errorString) {
-
-               try {
-                       theLog.printError(errorString);
-                       SimpleHash modelRoot = new SimpleHash();
-                       modelRoot.put("errorstring", new SimpleScalar(errorString));
-                       modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
-                       HTMLTemplateProcessor.process(res,Configuration.getProperty("Mir.ErrorTemplate"),modelRoot,out);
-                       out.close();
-               }
-               catch (Exception e) {
-                       System.err.println("Fehler in ErrorTemplate");
-               }
-
-       }
-
-       public String getServletInfo(){ return "OpenIndy 1.0 rev01"; }
+  public String getServletInfo(){ return "OpenIndy 1.0 rev01"; }
 
 }