The url to the resource. This is created by swiching the base path
 of the source file with the base url.
10789
def url
      url = source_path.to_s.sub(/^#{Regexp.escape(self.class.path)}/, '')
      url = url.sub(/\..+$/, extension)
      url = File.join(self.class.url, url) unless url.starts_with? self.class.url
      url = url.dasherize
      url
    end
180863
def _get_url(self, url):
        
        url = str(url)
        if url != 'default' and not '://' in url:
            url = "file:" + urllib.pathname2url(url)
        return url
1009309
def url2tmp(self, root, url):
        
        filename = url.rsplit('/', 1)[-1]
        return os.path.join(root, filename)
634006
def set_base_url(url):
    
    global _base_url, _dirty

    LOGGER.debug('Setting base URL to %s', url)
    _base_url = url
    _dirty = True
616007
public String getResourcePath() {
        final StringBuilder sb = new StringBuilder();
        for (final String r : resource)
            sb.append(r + '/');
        return sb.substring(0, Math.max(0, sb.length() - 1));
    }
636555
def path_to_url(path):
    
    path = os.path.normpath(os.path.abspath(path))
    url = urlparse.urljoin("file:", urllib2.pathname2url(path))
    return url
1355458
def file_path

      self.path= File.join(Dir.pwd, uri_file_name) unless path
      if File.directory?(path)
        self.path= File.join(self.path, uri_file_name)
      end

      self.path

    end
173911
def _context_source_file_url(path_or_url):
    
    if path_or_url.startswith('http'):
        # Remote CSV. Just return the URL
        return path_or_url

    if path_or_url.startswith('/'):
        # Absolute path
        return "file://" + path_or_url

    return "file://" + os.path.join(os.path.realpath(os.getcwd()), path_or_url)
6710
public URL getResourceURL(String filepath, URL urlCodeBase, String version, ClassLoader classLoader) throws RuntimeException
    {
        if (filepath == null)
            return null;
        if (File.separatorChar != '/')
            filepath = filepath.replace(File.separatorChar, '/'); // Just in case I get a window's path

        boolean isResource = true;
        if (urlCodeBase != null)
        	if ("file".equalsIgnoreCase(urlCodeBase.getProtocol()))
        		isResource = false;
        URL url = null;
        try {
        	if (isResource)
        		if (classLoader != null)
        		{
        			url = classLoader.getResource(filepath);
        			if (url == null)
        			    if (filepath.startsWith("/"))
        			        url = classLoader.getResource(filepath.substring(1));    // Classpaths shouldn't start with root
        		}
        } catch (Exception e) {
            // Keep trying
        }

        if (url == null)
        {
        	if (isResource)
        		if (this.getClassFinder(null) != null)
        			url = this.getClassFinder(null).findResourceURL(filepath, version);	// Try to find this class in the obr repos
        }

        if (url == null)
        {
            try
            {
                if (urlCodeBase != null)
                    url = new URL(urlCodeBase, filepath);
            } catch(MalformedURLException ex) {
                // Keep trying
            } catch (Exception e) {
                // Keep trying
            }
        }
        return url;
    }
230502
private URL getUrl() {
        ClassLoader loader = null;
        try {
            loader = Thread.currentThread().getContextClassLoader();
        } catch (Exception e) {
            // do nothing
        }

        if (loader == null) {
            loader = ClassPathResource.class.getClassLoader();
        }

        URL url = loader.getResource(this.resourceName);
        if (url == null) {
            // try to check for mis-used starting slash
            // TODO: see TODO below
            if (this.resourceName.startsWith("/")) {
                url = loader.getResource(this.resourceName.replaceFirst("[\\\\/]", ""));
                if (url != null)
                    return url;
            } else {
                // try to add slash, to make clear it's not an issue
                // TODO: change this mechanic to actual path purifier
                url = loader.getResource("/" + this.resourceName);
                if (url != null)
                    return url;
            }
            throw new IllegalStateException("Resource '" + this.resourceName + "' cannot be found.");
        }
        return url;
    }
144716
def _build_url(self, path):
        
        if path.startswith('http://') or path.startswith('https://'):
            return path
        else:
            return '%s%s' % (self._url, path)
770541
def build_url(self, path):
        
        url = '{0}{1}'.format(self.base_url, path)
        url = re.sub('([^:])//', '\\1/', url)  # Remove double slashes
        return url
822137
def add_resource(self, path, resource):
        

        assert isinstance(resource, Resource)
        path = path.strip("/")
        paths = path.split("/")
        actual_path = ""
        i = 0
        for p in paths:
            i += 1
            actual_path += "/" + p
            try:
                res = self.root[actual_path]
            except KeyError:
                res = None
            if res is None:
                resource.path = actual_path
                self.root[actual_path] = resource
        return True
1042507
def path_to_url(path, relative_to = nil)
      # Find the parent path we're in
      path = Pathname.new(path).realpath
      base = load_paths.find { |lp| path.to_s =~ /\A#{Regexp.escape(lp.realpath.to_s)}/ }

      path = path.relative_path_from(base).cleanpath

      if relative_to
        relative_path_to_url(path, relative_to, base).to_s
      else
        "/#{path}"
      end
    end
528638
def _build_base_url(self, host, port):
        
        parsed = urlparse(host)
        if not parsed.scheme:
            parsed = parsed._replace(scheme="http")
            parsed = parsed._replace(path="")
            netloc, parts = host, host.partition(":")
            if parts[1] == "" and port is not None:
                netloc = "{}:{}".format(parts[0], port)
            parsed = parsed._replace(netloc=netloc)
        parsed = parsed._replace(path=parsed.path.rstrip("/"))
        return parsed.geturl()
266848
def build_url(method, args)
        API::URL.new(method, config.base_url, args).path
      end
8723
def base_url(self):
        
        return get_current_url(
            self.environ, strip_querystring=True, trusted_hosts=self.trusted_hosts
        )