- } catch (ClassNotFoundException e) {
- // searching Servlet webdb.servlet-classes
- theServletModule = Class.forName("webdb.servlet.ServletModule" + moduleName);
- }
- //Instanciate the ServletModule
- Method m = theServletModule.getMethod("getInstance",null);
- smod = (ServletModule)m.invoke(null,null);
- ServletModuleDispatch.dispatch(smod,req,res);
- }
- catch (NoSuchMethodException e) { handleError( res.getWriter(), "ServletModule" + moduleName + " getInstance() nicht gefunden."); }
- catch (InvocationTargetException e) { handleError( res.getWriter(), "ServletModule" + moduleName + " target nicht gefunden."); }
- catch (ClassNotFoundException e) { handleError( res.getWriter(), "ServletModule" + moduleName + " nicht gefunden."); }
- catch (IllegalArgumentException e) { handleError( res.getWriter(), "ServletModule" + moduleName + " nicht gefunden."); }
- catch (ServletModuleException e){ handleError(res.getWriter(), "ServletException in Module ServletModule" + moduleName + " -- " + e.toString()); }
- catch (IllegalAccessException e){
- handleError(res.getWriter(), "Kein Zugriff auf Klasse ServletModule" + moduleName + " -- " + e.toString()); }
-
- // timing...
- sessionConnectTime = new java.util.Date().getTime() - startTime;
- theLog.printInfo("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms");
- }
-
- private void handleError(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(Configuration.getProperty("Mir.ErrorTemplate"),modelRoot,out);
- out.close();
- }
- catch (Exception e) {
- System.err.println("Fehler in ErrorTemplate");
- }
- }
-
- /**
- * evaluate login for user / password
- */
- protected EntityUsers allowedUser(String user, String password) {
- try {
- if (usersModule == null) usersModule = new ModuleUsers(DatabaseUsers.getInstance());
- return usersModule.getUserForLogin(user, password);
- }
- catch(Exception e) { theLog.printDebugInfo(e.toString()); return null; }
- }
-
- // Redirect-methods
- private void _sendLoginPage(HttpServletRequest req, PrintWriter out) {
+ }
+ //Instantiate the ServletModule
+ Method m = theServletModule.getMethod("getInstance",null);
+ smod = (ServletModule)m.invoke(null,null);
+ ServletModuleDispatch.dispatch(smod,req,res);
+ }
+ catch (NoSuchMethodException e) { handleError( res,res.getWriter(), "ServletModule" + moduleName + " getInstance() not found."); }
+ 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()); }
+
+ // timing...
+ sessionConnectTime = new java.util.Date().getTime() - startTime;
+ theLog.printInfo("EXECTIME (" + moduleName + "): " + 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,MirConfig.getProp("Mir.ErrorTemplate"),modelRoot,out);
+ out.close();
+ }
+ catch (Exception e) {
+ System.err.println("Error in ErrorTemplate");
+ }
+ }
+
+ 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
+ */
+ protected EntityUsers allowedUser(String user, String 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;
+ }
+ }
+
+ // Redirect-methods
+ private void _sendLoginPage(HttpServletResponse res,HttpServletRequest req, PrintWriter out) {