X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2FOpenMir.java;h=1b10a98d26643e6002efdc19cc0097014233376f;hb=13fd1cb27dfaaeba8590daae63e1f577e017b55c;hp=37b4d8a72132581f59449f355af50155df4a6874;hpb=86b6f499b413c722acc895346ac5186405b0c44c;p=mir.git diff --git a/source/OpenMir.java b/source/OpenMir.java index 37b4d8a7..1b10a98d 100755 --- a/source/OpenMir.java +++ b/source/OpenMir.java @@ -26,7 +26,7 @@ import mircoders.storage.*; public class OpenMir extends AbstractServlet { - private static boolean confed=false; + //private static boolean confed=false; private static String lang; public HttpSession session; @@ -41,11 +41,10 @@ public class OpenMir extends AbstractServlet { long startTime = (new java.util.Date()).getTime(); long sessionConnectTime=0; - - if (!confed){ - confed = getConfig(req); + // get the configration + if(getServletContext().getAttribute("mir.confed") == null) { + getConfig(req); } - session = req.getSession(); if(session.getAttribute("Language")==null){ @@ -56,23 +55,45 @@ public class OpenMir extends AbstractServlet { try { ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res); } + catch (ServletModuleUserException e) { + handleUserError(req,res,res.getWriter(), e.getMsg()); + } catch (ServletModuleException e){ e.printStackTrace(); - handleError(res,res.getWriter(), "OpenIndy :: ServletException in Module ServletModule -- " + e.toString()); + handleError(req,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) { - + private void handleUserError(HttpServletRequest req, 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,MirConfig.getProp("Mir.ErrorTemplate"),modelRoot,out); + HTMLTemplateProcessor.process(res,MirConfig.getProp("Mir.UserErrorTemplate"), + modelRoot, out, req.getLocale() ); + out.close(); + } + catch (Exception e) { + System.err.println("Fehler in UserErrorTemplate"); + } + + } + + private void handleError(HttpServletRequest req, 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,MirConfig.getProp("Mir.ErrorTemplate"), + modelRoot,out, req.getLocale()); out.close(); } catch (Exception e) {