request.setAttribute("selectedOrg", selectedOrg);
request.setAttribute(RequestUtil.ATTR_SELECTED_ORG, selectedOrg);
    private void showLoginPage(final HttpServletRequest request, final HttpServletResponse response, String errorType)            throws IOException, ServletException {        // TODO: Do not throw exceptions, set INTERNAL SERVER ERRROR status        String jspLocation = getServletContext().getInitParameter("jsp.location");        Properties config = getConfig();        HashMap serviceProperties = null;        /* Ticket */        String loginTicketId = request.getParameter(config.getProperty("loginTicketID"));        /* Base URL */        request.setAttribute("baseURL", config.getProperty("loginURLPrefix") + "?" + config.getProperty("loginTicketID") + "=" + loginTicketId);        try {            /* Service properties */            serviceProperties = MoriaController.getServiceProperties(loginTicketId);            /* Seclevel */            request.setAttribute("secLevel", "" + MoriaController.getSecLevel(loginTicketId));        } catch (AuthorizationException e) {            errorType = "authorization";        } catch (UnknownTicketException e) {            errorType = "unknownTicket";        } catch (IllegalInputException e) {            errorType = "illegalInput";        } catch (InoperableStateException e) {            errorType = "inoperableState";        }        /* Error message */        request.setAttribute("errorType", errorType);        /* Resource bundle */        String serviceLang = null;        if (serviceProperties != null) {            serviceLang = (String) serviceProperties.get("lang");        }        ResourceBundle bundle = RequestUtil.getBundle("login",                request.getParameter("lang"),                request.getCookies(),                serviceLang,                request.getHeader("Accept-Language"),                "en");        request.setAttribute("bundle", bundle);        /* Configured values */        request.setAttribute("organizationNames", RequestUtil.parseConfig(getConfig(), "org", bundle.getLocale().getLanguage()));        request.setAttribute("languages", RequestUtil.parseConfig(getConfig(), "lang", "common"));        /* Selected realm */        String selectedOrg = request.getParameter("org");        if (selectedOrg == null || selectedOrg.equals("")) {            RequestUtil.getCookieValue("org", request.getCookies());            if (selectedOrg == null || selectedOrg.equals("")) {                if (serviceProperties != null) {                    selectedOrg = (String) serviceProperties.get("home");                }            }        }        request.setAttribute("selectedOrg", selectedOrg);        /* Selected language */        request.setAttribute("selectedLang", bundle.getLocale());        if (request.getParameter("lang") != null) {            // TODO: Cookie TTL should come from config            response.addCookie(RequestUtil.createCookie("lang", request.getParameter("lang"), 7));        }        /* Service attributes */        if (serviceProperties != null) {            request.setAttribute("clientName", (String) serviceProperties.get("displayName"));            request.setAttribute("clientURL", (String) serviceProperties.get("url"));        }        // TODO: Include instead of forward        /* Process jsp */        RequestDispatcher rd = getServletContext().getRequestDispatcher(jspLocation + "/login.jsp");        rd.forward(request, response);    }