in src/main/java/org/apache/sling/auth/core/impl/PathBasedHolder.java [86:122]
protected PathBasedHolder(final String url, final ServiceReference<?> serviceReference) {
String newPath = url;
String newHost = "";
String newProtocol = "";
// check for protocol prefix in the full path
if (newPath.startsWith("http://") || newPath.startsWith("https://")) {
int idxProtocolEnd = newPath.indexOf("://");
newProtocol = newPath.substring(0, idxProtocolEnd);
newPath = newPath.substring(idxProtocolEnd + 1);
}
// check for host prefix in the full path
if (newPath.startsWith("//")) {
int idxHostEnd = newPath.indexOf("/", 2);
idxHostEnd = idxHostEnd == -1 ? newPath.length() : idxHostEnd;
if (newPath.length() > 2) {
newHost = newPath.substring(2, idxHostEnd);
if (idxHostEnd < newPath.length()) {
newPath = newPath.substring(idxHostEnd);
} else {
newPath = "/";
}
} else {
newPath = "/";
}
}
// assign the fields
this.fullPath = url;
this.path = newPath;
this.host = newHost;
this.protocol = newProtocol;
this.serviceReference = serviceReference;
}