public class OpenMir extends AbstractServlet {
- private static boolean confed=false;
+ //private static boolean confed=false;
private static String lang;
public HttpSession session;
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){
try {
ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res);
}
+ catch (ServletModuleUserException e) {
+ handleUserError(res,res.getWriter(), e.getMsg());
+ }
catch (ServletModuleException e){
e.printStackTrace();
handleError(res,res.getWriter(), "OpenIndy :: ServletException in Module ServletModule -- " + e.toString());
theLog.printInfo("EXECTIME (ServletModuleOpenIndy): " + sessionConnectTime + " ms");
}
+ 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");
+ }
+
+ }
+
private void handleError(HttpServletResponse res,PrintWriter out, String errorString) {
try {
SimpleHash modelRoot = new SimpleHash();
modelRoot.put("errorstring", new SimpleScalar(errorString));
modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
- HTMLTemplateProcessor.process(res,Configuration.getProperty("Mir.ErrorTemplate"),modelRoot,out);
+ HTMLTemplateProcessor.process(res,MirConfig.getProp("Mir.ErrorTemplate"),modelRoot,out);
out.close();
}
catch (Exception e) {