URI validation for URI schemes which allows only scheme and path components.
335411
private function isUriWithSchemeAndPathOnly()
    {
        return null === $this->authority
            && null === $this->query
            && null === $this->fragment;
    }
340270
def validate(self, value):
        ''''''
        if self.blank and value == '':
            return True
        if URIValidator.uri_regex.match(value):
            self._choice = value
            return True
        else:
            self.error_message = '%s is not a valid URI' % value
            return False
476020
public static ErrorCode isUriValid(String uri){
        if(uri == null || uri.isEmpty()){
            return ErrorCode.SERVICE_INSTANCE_URI_FORMAT_ERROR;
        }
        if (!isMustFieldValid(uri, urlRegEx)
                || ! isValidBrace(uri)) {
            return ErrorCode.SERVICE_INSTANCE_URI_FORMAT_ERROR;
        }
        return ErrorCode.OK;
    }
604460
private function validateState()
    {
        if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
            $this->host = self::DEFAULT_HTTP_HOST;
        }
        if ($this->getAuthority() === '') {
            if (0 === strpos($this->path, '//')) {
                throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
            }
            if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
                throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon');
            }
        } elseif (isset($this->path[0]) && $this->path[0] !== '/') {
            $this->path = '/' . $this->path;
        }
    }
952932
public static void checkUriScheme(String scheme, String message, Object... args) {
    String uri = String.format("%s://null", scheme);
    try {
      new URI(uri);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(String.format(message, args));
    }
  }
50086
@SuppressWarnings("unused")
    public static boolean isValidUri(String uri) {

        boolean result = false;
        try {
            new URI(uri);
            result = true;
        } catch (Exception e) {
            // nothing to do
        }
        return result;
    }
31994
public static void checkUriScheme(String scheme) {
    String uri = String.format("%s://null", scheme);
    try {
      new URI(uri);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(e);
    }
  }
1134191
def check_uri_security(uri):
    """"""
    if urlparse(uri).scheme != 'https':
        warning_message = (
            'WARNING: this client is sending a request to an insecure'
            ' API endpoint. Any API request you make may expose your API key and'
            ' secret to third parties. Consider using the default endpoint:\n\n'
            '  %s\n') % uri
        warnings.warn(warning_message, UserWarning)
    return uri
1012424
public static boolean containsWebSocketScheme(URI uri) {
        Objects.requireNonNull(uri, "no URI object given");

        final String scheme = uri.getScheme();
        if (scheme != null && (scheme.equals(WS_SCHEME) || scheme.equals(WSS_SCHEME))) {
            return true;
        }

        return false;
    }
1239538
def parse_http_scheme(uri):
    
    regex = re.compile(
        r'^(?:http)s?://',
        flags=re.IGNORECASE
    )
    match = regex.match(uri)

    return match.group(0) if match else 'http://'
682098
function(uri) {
    const scheme = this.getScheme(uri);

    if (PUBLIC === scheme || TEMPORARY === scheme) {
      return '/' + this.resolvePath(uri);
    }

    return uri;
  }
734700
@Override
    public FetchStatus checkFilter(URI uri) {
        if (uri == null) {
            return FetchStatus.OUT_OF_SCOPE;
        }

        String otherScheme = normalisedScheme(uri.getRawScheme());
        if (port != normalisedPort(otherScheme, uri.getPort())) {
            return FetchStatus.OUT_OF_SCOPE;
        }

        if (!scheme.equals(otherScheme)) {
            return FetchStatus.OUT_OF_SCOPE;
        }

        if (!hasSameHost(uri)) {
            return FetchStatus.OUT_OF_SCOPE;
        }

        if (!startsWith(uri.getRawPath(), path)) {
            return FetchStatus.OUT_OF_SCOPE;
        }

        return FetchStatus.VALID;
    }
577762
def uri_tree_precode_check(uri_tree, type_host = HOST_REG_NAME):
    
    scheme, authority, path, query, fragment = uri_tree # pylint: disable-msg=W0612
    if scheme:
        if not valid_scheme(scheme):
            raise InvalidSchemeError, "Invalid scheme %r" % (scheme,)
    if authority:
        user, passwd, host, port = authority # pylint: disable-msg=W0612
        if port and not __all_in(port, DIGIT):
            raise InvalidPortError, "Invalid port %r" % (port,)
        if type_host == HOST_IP_LITERAL:
            if host and (not __valid_IPLiteral(host)):
                raise InvalidIPLiteralError, "Invalid IP-literal %r" % (host,)
        elif type_host == HOST_IPV4_ADDRESS:
            if host and (not __valid_IPv4address(host)):
                raise InvalidIPv4addressError, "Invalid IPv4address %r" % (host,)
    if path:
        if authority and path[0] != '/':
            raise InvalidPathError, "Invalid path %r - non-absolute path can't be used with an authority" % (path,)
    return uri_tree
852387
def validate_resource_uri(self, path):
        """"""
        if self._base_uri not in path:
            logger.exception('Get by uri : unrecognized uri: (%s)' % path)
            raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI)
1275543
private static String checkFileURIScheme(Collection<URI> uris) {
    for (URI uri : uris)
      if (uri.getScheme().compareTo(JournalType.FILE.name().toLowerCase()) != 0)
        return "The specified path is not a file."
            + "Avatar supports file non-shared storage only... ";
    return "";
  }
689364
function(uri) {

        if (this._routes[uri] !== undefined) {
            return uri;
        }

        for (var route in this._routes) {
            if (this.is(route, uri)) {
                return route;
            }
        }

        return false;
    }
580710
def valid_path(value):
    ""
    # Generate UnicodeDecodeError if path can't store as ASCII.
    value.encode("ascii")
    # Cookies without leading slash will likely be ignored, raise ASAP.
    if not (value and value[0] == "/"):
        return False
    if not Definitions.PATH_RE.match(value):
        return False
    return True