in src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java [269:287]
static String toAbsoluteUri(final String scheme, final String host,
final int port, final String targetPath) {
// 1. scheme and host
final StringBuilder absUriBuilder = new StringBuilder();
absUriBuilder.append(scheme).append("://").append(host);
// 2. append the port depending on the scheme and whether the port is
// the default or not
if (port > 0) {
if (!(("http".equals(scheme) && port == 80) || ("https".equals(scheme) && port == 443))) {
absUriBuilder.append(':').append(port);
}
}
// 3. the actual target path
absUriBuilder.append(targetPath);
return absUriBuilder.toString();
}