public static SimplePathInfo parsePathInfo()

in src/main/java/org/apache/sling/distribution/resources/impl/common/SimplePathInfo.java [84:116]


    public static SimplePathInfo parsePathInfo(String resourceRoot, String requestPath) {
        if (!requestPath.startsWith(resourceRoot)) {
            return null;
        }

        String resourceName = null;
        String resourcePathInfo = null;

        if (requestPath.startsWith(resourceRoot + "/")) {
            resourceName = requestPath.substring(resourceRoot.length() + 1);
            int idx = resourceName.indexOf(".");
            if (idx >= 0) {
                resourcePathInfo = resourceName.substring(idx);
                resourceName = resourceName.substring(0, idx);
            }
        } else {
            int idx = requestPath.indexOf(".");
            if (requestPath.contains(".")) {
                resourcePathInfo = requestPath.substring(idx);
            }
        }

        String childResourceName = null;

        if (resourceName != null) {
            int idx = resourceName.indexOf("/");
            if (idx >= 0) {
                childResourceName = resourceName.substring(idx + 1);
                resourceName = resourceName.substring(0, idx);
            }
        }
        return new SimplePathInfo(resourcePathInfo, resourceRoot, resourceName, childResourceName);
    }