res.setStatus(res.SC_SEE_OTHER);
res.setStatus(HttpServletResponse.SC_SEE_OTHER);
    void sendRedirect(HttpServletRequest req, HttpServletResponse res, String url) {        String location = url;        if (url.indexOf("://") == -1) {            // need to transform a relative URL into an absolute one            String scheme = req.getScheme();            StringBuffer loc = new StringBuffer(scheme);            loc.append("://");            loc.append(req.getServerName());            int p = req.getServerPort();            // check if we need to include server port            if ((p > 0) &&                    (("http".equals(scheme) && (p != 80)) ||                    ("https".equals(scheme) && (p != 443)))) {                loc.append(":");                loc.append(p);            }            if (!url.startsWith("/")) {                String requri = req.getRequestURI();                int lastSlash = requri.lastIndexOf("/");                if (lastSlash == (requri.length() - 1)) {                    loc.append(requri);                } else if (lastSlash > -1) {                    loc.append(requri.substring(0, lastSlash + 1));                } else {                    loc.append("/");                }            }            loc.append(url);            location = loc.toString();        }        // send status code 303 for HTTP 1.1, 302 otherwise        if (isOneDotOne(req.getProtocol())) {            res.setStatus(res.SC_SEE_OTHER);        } else {            res.setStatus(res.SC_MOVED_TEMPORARILY);        }        res.setContentType("text/html");        res.setHeader("Location", location);    }