Provisioning prov = Provisioning.getInstance(); Server server = prov.getLocalServer(); String redirectUrl = server.getAttr(Provisioning.A_zimbraMailURL);  if (redirectUrl.charAt(redirectUrl.length() - 1) == '/') { redirectUrl += "mail"; } else { redirectUrl += "/mail"; }
Provisioning prov = Provisioning.getInstance(); Server server = prov.getLocalServer(); String redirectUrl = server.getAttr(Provisioning.A_zimbraMailURL, DEFAULT_MAIL_URL);  if (redirectUrl.charAt(redirectUrl.length() - 1) == '/') { redirectUrl += "mail"; } else { redirectUrl += "/mail"; }
    private void setCookieAndRedirect(HttpServletRequest req, HttpServletResponse resp, String authToken) throws IOException, ServiceException {        Cookie c = new Cookie(COOKIE_ZM_AUTH_TOKEN, authToken);        c.setPath("/");        resp.addCookie(c);        String redirectURL = getOptionalParam(req, PARAM_REDIRECT_URL, null);        if (redirectURL != null) {            resp.sendRedirect(redirectURL);        } else {            StringBuilder sb = new StringBuilder();            addNonPreAuthParams(req, sb, true);	    Provisioning prov = Provisioning.getInstance();	    Server server = prov.getLocalServer();	    String redirectUrl = server.getAttr(Provisioning.A_zimbraMailURL);	    // NB: do we really have to add the mail app to the end?	    if (redirectUrl.charAt(redirectUrl.length() - 1) == '/') {		redirectUrl += "mail";	    } else {		redirectUrl += "/mail";	    }            if (sb.length() > 0) {                resp.sendRedirect(redirectUrl + "?" + sb.toString());            } else {                resp.sendRedirect(redirectUrl);            }        }    }