/** * Redirects to the given <code>url</code>. * * @param request The request. Used to retrieve the context path. * @param response The response upon which to redirect. * @param url The url to redirect to. */ protected void redirect( final SlingHttpServletRequest request, final SlingHttpServletResponse response, final String url) { try { final String cp = request.getContextPath(); String newURL = url; if (!"".equals(cp) && !url.contains("://") && !url.startsWith(cp)) { newURL = cp + url; } response.sendRedirect(newURL); } catch (final IOException ioe) { log.error("failed to redirect to {}", url, ioe); } }