Checks whether the URL is a descendant of a URL provided as an argument.
If the provided URL does not specify protocol, then it will match any protocol of the URL
@param url a bluetooth URL
@return true if the URL is a descendant of a provided URL
768461
public boolean isDescendant(URL url) {
        if (url.protocol != null && protocol != null && !protocol.equals(url.protocol)) {
            return false;
        }

        if (adapterAddress != null && url.adapterAddress == null) {
            return true;
        }

        if (adapterAddress != null && !adapterAddress.equals(url.adapterAddress)) {
            return false;
        }

        if (deviceAddress != null && url.deviceAddress == null) {
            return true;
        }

        if (deviceAddress != null && !deviceAddress.equals(url.deviceAddress)) {
            return false;
        }

        if (serviceUUID != null && url.serviceUUID == null) {
            return true;
        }
        if (serviceUUID != null ? !serviceUUID.equals(url.serviceUUID) : url.serviceUUID != null) {
            return false;
        }

        if (characteristicUUID != null && url.characteristicUUID == null) {
            return true;
        }
        if (characteristicUUID != null
                ? !characteristicUUID.equals(url.characteristicUUID) :
                url.characteristicUUID != null) {
            return false;
        }

        return fieldName != null && url.fieldName == null;
    }
100403
function( url ) {
            var match = url.match(/^([a-z]+:)\/\//i);
            if ( match === null ) {
                // Relative URL, retrive the protocol from window.location
                return window.location.protocol;
            }
            return match[1].toLowerCase();
        }
219038
public boolean acceptsURL(String url) {

        if (url == null) {
            return false;
        }

        return url.regionMatches(true, 0, DatabaseURL.S_URL_PREFIX, 0,
                                 DatabaseURL.S_URL_PREFIX.length());
    }
95521
@Override
    public boolean canServe(URL refUrl) {
        if (refUrl == null || !this.getPath().equals(refUrl.getPath())) {
            return false;
        }

        if(!protocol.equals(refUrl.getProtocol())) {
            return false;
        }

        if (!Constants.NODE_TYPE_SERVICE.equals(this.getParameter(URLParamType.nodeType.getName()))) {
            return false;
        }

        String version = getParameter(URLParamType.version.getName(), URLParamType.version.getValue());
        String refVersion = refUrl.getParameter(URLParamType.version.getName(), URLParamType.version.getValue());
        if (!version.equals(refVersion)) {
            return false;
        }

        // check serialize
        String serialize = getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue());
        String refSerialize = refUrl.getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue());
        if (!serialize.equals(refSerialize)) {
            return false;
        }
        // Not going to check group as cross group call is needed
        return true;
    }
320404
private boolean checkUrl(String url) {
        try {
            URI uri = new URI(url);
            return uri.isAbsolute();
        } catch (URISyntaxException e) {
            return false;
        }
    }
1041943
private static String parseRelativeURL(URL url, String spec) {
        String path = url.getPath();
        String result;

        int index = path.indexOf("!/");
        if (index == -1) {
            // The "jar" protocol requires that the path contain an entry path.
            // For backwards compatibility, we do not.  Instead, we just
            // canonicalize the base URL.
            try {
                url = Utils.newURL(Utils.newURL(path), spec);
            } catch (MalformedURLException ex) {
                throw new RuntimeException(ex);
            }

            result = url.toString();
        } else {
            String entry;

            if (spec.startsWith("/")) {
                // This is an absolute entry path, so we ignore the existing
                // entry path.
                entry = canonicalize(spec);
            } else {
                // Extract the existing entry path.
                entry = path.substring(index + 1);

                if (entry.endsWith("/")) {
                    // The entry ends with '/', so we can directly append the
                    // relative entry path.
                    entry = canonicalize(entry + spec);
                } else if (entry.endsWith("/.")) {
                    // We don't want the logic below because "." is not a
                    // "true" basename.
                    entry = canonicalize(entry + '/' + spec);
                } else {
                    // Strip off the basename with a ".." path segment and
                    // append the relative entry path.
                    entry = canonicalize(entry + "/../" + spec);
                }
            }

            result = path.substring(0, index) + '!' + entry;
        }
        return result;
    }
761308
public static boolean isJarFileURL(URL url) {
		return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && //
				url.getPath().toLowerCase().endsWith(FileUtil.JAR_FILE_EXT));
	}
988806
public static boolean isUrl(CharSequence value) {
		try {
			new java.net.URL(StrUtil.str(value));
		} catch (MalformedURLException e) {
			return false;
		}
		return true;
	}
723632
def _is_valid_url(url):
        
        try:
            parsed = urlparse(url)
            mandatory_parts = [parsed.scheme, parsed.netloc]
            return all(mandatory_parts)
        except:
            return False
875699
public static boolean isPathNameMatch(String uri, String urlPattern) {
        if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) {
            String s = urlPattern.substring(0, urlPattern.length() - 1);
            /**
             * First case,urlPattern
             * /a/b/c/ matches /a/b/c/*
             **/
            if (s.equalsIgnoreCase(uri)) {
                return true;
            }
            /**
             * Second case
             * /a/b/c matches /a/b/c/*
             **/
            if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) {
                return true;
            }

            /**
             * Third case
             * /a/b/c/d/e matches /a/b/c/*
             **/
            if (uri.startsWith(s)) {
                return true;
            }
        }

        return false;
    }
394755
public static String getProtocol(String url)
  {
    if(url == null) {
      return null;
    }
    int protocolSeparatorIndex = url.indexOf("://");
    if(protocolSeparatorIndex == -1) {
      return null;
    }
    return url.substring(0, protocolSeparatorIndex).toLowerCase();
  }
414491
function(url) {
    var protocol;
    if (url.indexOf('http://') !== -1) {
      protocol = http;
    } else if (url.indexOf('https://') !== -1) {
      protocol = https;
    } else {
      throw new Error('unsupported protocol :' + url);
    }

    return protocol;
  }
556091
public static boolean isHttp(String url) {
		if (url.length() < 7 || !url.startsWith("http")) {
			return false;
		}
		int i = 4; // "http"
		if (url.charAt(i) == 's') {
			i++;
		}
		return url.startsWith("://", i);
	}
1135296
public static UrlBuilder parse(URL url) {
        final UrlBuilder result = new UrlBuilder();

        if (url != null) {
            final String protocol = url.getProtocol();
            if (protocol != null && !protocol.isEmpty()) {
                result.withScheme(protocol);
            }

            final String host = url.getHost();
            if (host != null && !host.isEmpty()) {
                result.withHost(host);
            }

            final int port = url.getPort();
            if (port != -1) {
                result.withPort(port);
            }

            final String path = url.getPath();
            if (path != null && !path.isEmpty()) {
                result.withPath(path);
            }

            final String query = url.getQuery();
            if (query != null && !query.isEmpty()) {
                result.withQuery(query);
            }
        }

        return result;
    }
1183817
function (url) {
        if (_.isEmpty(url)) {
            return false;
        }

        // convert url strings to Url
        (typeof url === STRING) && (url = new Url(url));

        // this ensures we don't proceed any further for any protocol
        // that is not https
        if (url.protocol !== HTTPS) {
            return false;
        }

        // test the input url against allowed matches
        return this.matches.test(url);
    }
95357
protected boolean included(String url) {
        for (final Pattern urlPattern : this.includedUrls) {
            final Matcher matcher = urlPattern.matcher(url);
            if (matcher.matches()) {
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Include pattern " + urlPattern.pattern() + " matches " + url);
                }
                return true;
            }
        }
        
        return false;
    }
525610
public static boolean isExtensionMatch(String uriName, String urlPattern) {
        if (urlPattern.startsWith("*.")) {
            String ext = urlPattern.substring(1);
            if (uriName.endsWith(ext)) {
                return true;
            }
        }
        return false;
    }