Rewrites the requested path to remove leading slashes and prefix with
"resources/"

Note: we don't check for backtracking.

@param path the requested path (e.g. "/foo/bar")
@return the rewritten path (e.g. "resources/foo/bar")
177036
private static String rewritePath(String path) {
        while (path.startsWith("/")) {
            path = path.substring(1);
        }
        // Note, ClassLoader paths are always absolute, so , so no leading slash
        return "resources/" + path;
    }
197270
public static String removeExtension(String path) throws IllegalArgumentException
  {
    Params.notNull(path, "Path");
    int extensionIndex = path.lastIndexOf('.');
    return extensionIndex != -1 ? path.substring(0, extensionIndex) : path;
  }
568714
public ConfigurationUpdate removePath(String path) {
		if (path == null || !path.startsWith("/")) {
			throw new IllegalArgumentException("Path must start with \"/\".");
		}
		paths.put(path, null);
		return this;
	}
1059200
@Override
	public Set<InputStream> getResourcesAsStream(final String path) throws IOException
	{
		// First, try the path as specified
		final Set<InputStream> streams = inner.getResourcesAsStream(path);

		// If no results were found and the path was absolute, retry without the leading slash
		if ((streams == null || streams.isEmpty()) && !path.isEmpty() && path.charAt(0) == '/')
		{
			// Strip the leading slash away and re-try the path
			// This lets us
			final String newPath = path.substring(1);

			return inner.getResourcesAsStream(newPath);
		}
		else
		{
			return streams;
		}
	}
878159
public static String removeIndexFromPath(String path)
   {
      if (path.endsWith("]"))
      {
         int index = path.lastIndexOf('[');
         if (index != -1)
         {
            return path.substring(0, index);
         }
      }
      return path;
   }
150728
@Override
	public Set<String> getResourceNames(String path) {
		path = path.replace('/', File.separatorChar);
		File resource = new File(baseDir, path);
		return FileUtils.getResourceNames(resource);
	}
700984
public static String cleanPath(String path) {
        if (path.endsWith(SEPARATOR)) {
            path = path.replaceAll(SEPARATOR + "+$", "");
        }
        if (path.startsWith(SEPARATOR)) {
            path = path.replaceAll("^" + SEPARATOR + "+", "");
        }
        return path.replaceAll("/+", SEPARATOR);
    }
78533
public static String encodePath(String path) {
    StringBuffer encodedPathBuf = new StringBuffer();
    for (String pathSegment : path.split("/")) {
      if (!pathSegment.isEmpty()) {
        if (encodedPathBuf.length() > 0) {
          encodedPathBuf.append("/");
        }
        encodedPathBuf.append(S3Escaper.encode(pathSegment));
      }
    }

    if (path.startsWith("/")) {
      encodedPathBuf.insert(0, "/");
    }
    if (path.endsWith("/")) {
      encodedPathBuf.append("/");
    }

    return encodedPathBuf.toString();
  }
1087215
public static String encodePath(String path) {
        if (path == null || path.length() == 0)
            return path;

        StringBuilder buf = encodePath(null, path, 0);
        return buf == null ? path : buf.toString();
    }
798133
public static String getNodeFromPath(String path)
    {
        PathUtils.validatePath(path);
        int i = path.lastIndexOf(PATH_SEPARATOR);
        if ( i < 0 )
        {
            return path;
        }
        if ( (i + 1) >= path.length() )
        {
            return "";
        }
        return path.substring(i + 1);
    }
1143588
@Override
    public InputStream getResourceAsStream( String path )
    {
        Object in = null;
        if ( null != baseLoader )
            // classloader wants no leading slash
            in = baseLoader.getResourceAsStream( path.substring(1) );
        if ( null == in )
            return super.getResourceAsStream( path );
        return (InputStream) in;
    }
23991
protected String normalizePath(String path) {

        if (path.equals("/")) {
            return path;
        } else {
            return CmsFileUtil.removeTrailingSeparator(path);
        }

    }
126851
def proper_path(path):
    
    if path.startswith("./"):
        pass
    elif path.startswith("/"):
        path = ".%s" % path
    elif path.startswith("."):
        while path.startswith("."):
            path = path[1:]
        if path.startswith("/"):
            path = ".%s" % path
    else:
        path = "./%s" % path

    if not path.endswith("/"):
        path += "/"

    return path
413902
@Override
    public Resource getResource(String path) {
	int index = path.indexOf("://");
	if (index != -1) {
	    String scheme = path.substring(0, index).toLowerCase().trim();
	    String subPath = path.substring(index + 3);
	    for (int i = 0; i < resources.length; i++) {
		if (scheme.equalsIgnoreCase(resources[i].getScheme())) {
		    return resources[i].instance().getResource(subPath);
		}
	    }
	}
	return defaultResource.getResource(path);
    }
572010
public static String fixupPath(String path) {
        // Hack-fix for mounting on Windows where the ${projectDir} variable and other
        // contain backslashes and what not. Related to #188
        Pattern pattern = Pattern.compile("^(?i)([A-Z]):(.*)$");
        Matcher matcher = pattern.matcher(path);
        if (matcher.matches()) {
            String result = "/" + matcher.group(1).toLowerCase() + matcher.group(2);
            return result.replace("\\","/");
        }
        return path;
    }
841439
private String fixRequestPath(String path) {
		return path.endsWith("/") ? path.substring(0, path.length() - 1) : path;
	}
868217
@Override
	public boolean matchPath(String path) {

		boolean match = false;
		if (StringUtils.isNotEmpty(path)) {
			match = path.startsWith(prefix);
		}
		return match;
	}