in src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java [186:210]
static String toRedirectPath(String targetPath, SlingJakartaHttpServletRequest request) {
// make sure the target path is absolute
final String rawAbsPath;
if (targetPath.startsWith("/")) {
rawAbsPath = targetPath;
} else {
rawAbsPath = request.getResource().getPath() + "/" + targetPath;
}
final StringBuilder target = new StringBuilder();
// and ensure the path is normalized, us unnormalized if not possible
final String absPath = ResourceUtil.normalize(rawAbsPath);
if (absPath == null) {
target.append(rawAbsPath);
} else {
target.append(absPath);
}
appendSelectorsExtensionSuffixQuery(request, target);
// return the mapped full path
return request.getResourceResolver().map(request, target.toString());
}