/* ------------------------------------------------------------ */ public void sendRedirect(String url) throws IOException { if (url == null) throw new IllegalArgumentException(); if (!URI.hasScheme(url)) { StringBuffer buf = _servletHttpRequest.getHttpRequest().getRootURL(); if (url.startsWith("/")) buf.append(URI.canonicalPath(url)); else { String path = _servletHttpRequest.getRequestURI(); String parent = (path.endsWith("/")) ? path : URI.parentPath(path); url = URI.canonicalPath(URI.addPaths(parent, url)); if (!url.startsWith("/")) buf.append('/'); buf.append(url); } url = buf.toString(); } resetBuffer(); _httpResponse.setField(HttpFields.__Location, url); _httpResponse.setStatus(HttpResponse.__302_Moved_Temporarily); complete(); }