X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2FMir.java;h=afa63cd3aee4b7973561d9d24383cd1049a7f343;hb=52183ff24543440c1a0e5d7377c81879d268124a;hp=49e24dcda45f55a95e17de769528e06a65b9b744;hpb=e6452406b836ccd6c19002b4dd4225bb4b085716;p=mir.git diff --git a/source/Mir.java b/source/Mir.java index 49e24dcd..afa63cd3 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -51,6 +51,7 @@ public class Mir extends AbstractServlet if (!confed){ confed = getConfig(req); } + MirConfig.setServletName(getServletName()); session = req.getSession(true); @@ -165,6 +166,9 @@ public class Mir extends AbstractServlet catch (InvocationTargetException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " target not found."); } catch (ClassNotFoundException e) { handleError(res, res.getWriter(), "ServletModule" + moduleName + " not found."); } catch (IllegalArgumentException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " not found."); } + catch (ServletModuleUserException e) { + handleUserError(res,res.getWriter(), e.getMsg()); + } catch (ServletModuleException e){ handleError(res,res.getWriter(), "ServletException in Module ServletModule" + moduleName + " -- " + e.toString()); } catch (IllegalAccessException e){ handleError(res,res.getWriter(), "No access to class ServletModule" + moduleName + " -- " + e.toString()); } @@ -188,6 +192,21 @@ public class Mir extends AbstractServlet } } + private void handleUserError(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.UserErrorTemplate"),modelRoot,out); + out.close(); + } + catch (Exception e) { + System.err.println("Fehler in UserErrorTemplate"); + } + + } /** * evaluate login for user / password */