// get the configration
if (!confed){
confed = getConfig(req);
- MirConfig.setServletName(req.getServerName());
}
+ MirConfig.setServletName(getServletName());
session = req.getSession(true);
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()); }
}
}
+ 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
*/
try {
if (usersModule == null) usersModule = new ModuleUsers(DatabaseUsers.getInstance());
return usersModule.getUserForLogin(user, password);
+ } catch(Exception e) {
+ theLog.printDebugInfo(e.toString());
+ e.printStackTrace();
+ return null;
}
- catch(Exception e) { theLog.printDebugInfo(e.toString()); return null; }
}
// Redirect-methods
// merge with logged in user and messages
SimpleHash mergeData = new SimpleHash();
mergeData.put("session",sessionUrl);
- mergeData.put("login_user", HTMLTemplateProcessor.makeSimpleHash(userEntity));
+ mergeData.put("login_user", userEntity);
if (messageModule == null) messageModule = new ModuleMessage(DatabaseMessages.getInstance());
mergeData.put("messages", HTMLTemplateProcessor.makeSimpleList(messageModule.getByWhereClause(null, "webdb_create desc",0,10)));
HTMLTemplateProcessor.process(res,getLanguage(req,session)+"/"+startTemplate, mergeData,out);