- theLog.printInfo("--login: successful! setting uid: " + userEntity.getId());
- session.setAttribute("login.uid", userEntity);
- theLog.printDebugInfo("--login: trying to retrieve login.target");
- String target = (String)session.getAttribute("login.target");
- if (target != null) {
- theLog.printDebugInfo("Redirect: "+target);
- res.getWriter().println("<html><head><meta http-equiv=refresh content=\0421;URL="
- + res.encodeURL(http +"://" + req.getServerName()+ target)
- + "\"></head><body>going " + target + "</body></html>");
- } else {
- // redirecting to default target
- //theLog.printDebugInfo("--login: no target - redirecting to default");
- _sendStartPage(req, res.getWriter(),userEntity);
- }
- return;
- } // if login succesful
- } // if login
-
- if (moduleName!=null && moduleName.equals("logout")) {
- theLog.printDebugInfo("--logout");
- session.invalidate();
- _sendLoginPage(req,res.getWriter());
- return;
- }
-
- // Check if authed!
- EntityUsers userEntity = (EntityUsers)session.getAttribute("login.uid");
- if (userEntity == null) {
- // redirect to loginpage
- String redirectString = req.getRequestURI();
- if (req.getQueryString()!=null) redirectString += "?" + req.getQueryString();
- theLog.printDebugInfo("STORING: " + redirectString);
- session.setAttribute("login.target", redirectString);
- _sendLoginPage(req,res.getWriter());
- return;
- }
-
- // Bei blossem Serveltaufruf redirect auf Standardstarttemplate
- if (moduleName == null || moduleName.equals("")) {
- _sendStartPage(req, res.getWriter(),userEntity);
- return;
- }
-
- //From now on normal Dispatching...
- try {
- try {
+ theLog.printInfo("--login: successful! setting uid: " + userEntity.getId());
+ session.setAttribute("login.uid", userEntity);
+ theLog.printDebugInfo("--login: trying to retrieve login.target");
+ String target = (String)session.getAttribute("login.target");
+
+ if (target != null) {
+ theLog.printDebugInfo("Redirect: "+target);
+ int serverPort = req.getServerPort();
+ String redirect = "";
+ String redirectString ="";
+
+
+ if(serverPort==80){
+ redirect=res.encodeURL(http + "://" + req.getServerName() + target);
+ redirectString = "<html><head><meta http-equiv=refresh content=\"1;URL="
+ + redirect
+ + "\"></head><body>going <a href=\"" + redirect + "\">Mir</a></body></html>";
+ } else {
+ redirect=res.encodeURL(http + "://" + req.getServerName() + ":" +req.getServerPort() + target);
+ redirectString = "<html><head><meta http-equiv=refresh content=\"1;URL="
+ + redirect
+ + "\"></head><body>going <a href=\"" + redirect + "\">Mir</a></body></html>";
+ }
+ res.getWriter().println(redirectString);
+
+
+ //res.sendRedirect(redirect);
+
+ } else {
+ // redirecting to default target
+ theLog.printDebugInfo("--login: no target - redirecting to default");
+ _sendStartPage(res,req,res.getWriter(),userEntity);
+ }
+ return;
+ } // if login succesful
+ } // if login
+
+ if (moduleName!=null && moduleName.equals("logout")) {
+ theLog.printDebugInfo("--logout");
+ session.invalidate();
+ _sendLoginPage(res,req,res.getWriter());
+ return;
+ }
+
+ // Check if authed!
+ EntityUsers userEntity = (EntityUsers)session.getAttribute("login.uid");
+ if (userEntity == null) {
+ // redirect to loginpage
+ String redirectString = req.getRequestURI();
+ String queryString = req.getQueryString();
+ if (queryString!=null && !queryString.equals("")) {
+ redirectString += "?" + req.getQueryString();
+ theLog.printDebugInfo("STORING: " + redirectString);
+ session.setAttribute("login.target", redirectString);
+ }
+ _sendLoginPage(res,req,res.getWriter());
+ return;
+ }
+
+ // If no module is specified goto standard startpage
+ if (moduleName == null || moduleName.equals("")) {
+ theLog.printDebugInfo("no module: redirect to standardpage");
+ _sendStartPage(res,req, res.getWriter(),userEntity);
+ return;
+ }
+
+ //From now on regular dispatching...
+ try {
+ try {
+ theServletModule = Class.forName("mircoders.servlet.ServletModule" + moduleName);
+ } catch (ClassNotFoundException e) {
+ // searching servletmodule in mir.servlet-classes