+ /**
+ * Private method getServletModuleForName returns ServletModule
+ * from Cache
+ *
+ * @return ServletModule
+ *
+ */
+ private static ServletModule getServletModuleForName(String moduleName)
+ throws ServletModuleException {
+
+ // Instance in Map ?
+ if (!servletModuleInstanceHash.containsKey(moduleName)) {
+ // was not found in hash...
+ try {
+ Class theServletModuleClass=null;
+ try {
+ // first we try to get ServletModule from stern.che3.servlet
+ theServletModuleClass = Class.forName("mircoders.servlet.ServletModule" + moduleName);
+ } catch (ClassNotFoundException e) {
+ // on failure, we try to get it from lib-layer
+ theServletModuleClass = Class.forName("mir.servlet.ServletModule"+ moduleName);
+ }
+ Method m = theServletModuleClass.getMethod("getInstance", null);
+ ServletModule smod = (ServletModule)m.invoke(null, null);
+ // we put it into map for further reference
+ servletModuleInstanceHash.put(moduleName,smod);
+ return smod;
+ } catch (Exception e) {
+ throw new ServletModuleException("*** error resolving classname for " +
+ moduleName +" -- "+ e.toString());
+ }
+ }
+ else return (ServletModule)servletModuleInstanceHash.get(moduleName);
+ }
+
+
+ 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) {
+ System.err.println("Error in ErrorTemplate");
+ }
+ }
+
+ 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.UserErrorTemplate"),
+ modelRoot,out, req.getLocale());
+ 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) {