showLoginPage(request, response, "directoryDown");
showLoginPage(request, response, RequestUtil.ERROR_DIRECTORY_DOWN);
    public final void doPost(final HttpServletRequest request, final HttpServletResponse response)            throws IOException, ServletException {        Properties config = getConfig();        /* Login ticket */        String loginTicketId = request.getParameter(config.getProperty("loginTicketID"));        /* SSO ticket */        String ssoTicketId = request.getParameter(config.getProperty("ssoTicketID"));        String username = request.getParameter("username");        String password = request.getParameter("password");        String org = request.getParameter("org");        /* Parse username */        if (username.indexOf("@") != -1) {            org = username.substring(username.indexOf("@") + 1, username.length());        }        /* Validate input *///        if (username == null || username.equals("")) {//            showLoginPage(request, response, "nocred");//            return;//        } else if (password == null || password.equals("")) {//            showLoginPage(request, response, "nocred");//            return;//        } else        if (org == null || org.equals("") || org.equals("null")) {            showLoginPage(request, response, "noorg");            return;        } else if (!RequestUtil.parseConfig(getConfig(), "org", "en").containsValue(org)) { // TODO: Requires english bundle            showLoginPage(request, response, "errorg");            return;        }        /* Attempt login */        Map tickets;        String redirectURL;        try {            tickets = MoriaController.attemptLogin(loginTicketId, ssoTicketId, username+"@"+org, password);            redirectURL = MoriaController.getRedirectURL((String) tickets.get(MoriaController.SERVICE_TICKET));        } catch (AuthenticationException e) {            showLoginPage(request, response, "auth");            return;        } catch (UnknownTicketException e) {            showLoginPage(request, response, "unknownTicket");            return;        } catch (DirectoryUnavailableException e) {            // TODO: Create error message            showLoginPage(request, response, "directoryDown");            return;        } catch (InoperableStateException e) {            // TODO: Create error message            showLoginPage(request, response, "moriaDown");            return;        } catch (IllegalInputException e) {            // TODO: Create error message            showLoginPage(request, response, "nocred");            return;            /* This should not happen. Programming error. */        }        response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);        response.setHeader("Location", redirectURL);        // TODO: Set SSO ticket in cookie    }