public static final ApiRequestPathInfo parseApiRequestPath(String apiVersionHeader, String acceptHeader, String pathInfo) {
        ApiRequestPathInfo info = new ApiRequestPathInfo();

        boolean versionFound = false;

        if (apiVersionHeader != null && apiVersionHeader.trim().length() > 0) {
            info.apiVersion = apiVersionHeader;
            versionFound = true;
        } else {
            if (acceptHeader != null && acceptHeader.startsWith("application/apiman.")) {
                String [] split = acceptHeader.split("\\+");
                info.apiVersion = split[0].substring("application/apiman.".length());
                versionFound = true;
            }
        }

        int minParts = versionFound ? 3 : 4;

        if (pathInfo != null) {
            String[] split = pathInfo.split("/");
            if (split.length >= minParts) {
                info.orgId = split[1];
                info.apiId = split[2];
                if (!versionFound) {
                    info.apiVersion = split[3];
                }
                if (split.length > minParts) {
                    StringBuilder resource = new StringBuilder();
                    for (int idx = minParts; idx < split.length; idx++) {
                        resource.append('/');
                        resource.append(urlEncode(split[idx]));
                    }
                    if (pathInfo.endsWith("/")) {
                        resource.append('/');
                    }
                    info.resource = resource.toString();
                } else if (pathInfo.endsWith("/")) {
                	info.resource = "/";
                }
            }
        }
        return info;
    }
Parses the HTTP request and returns an object containing all of the API
information (Org, Id, Version).
@param apiVersionHeader the API Version header
@param acceptHeader the accept header
@param pathInfo the path info
@return the parsed object containing API information.
common/util/src/main/java/io/apiman/common/util/ApimanPathUtils.java