Java Utililty Methods URI Value Check

List of utility methods to do URI Value Check

Description

The list of methods to do URI Value Check are organized into topic(s).

Method

booleanisNormalized(String uriName)
is Normalized
URI uri = URI.create(uriName);
return uri.getPath().equals(uri.normalize().getPath());
booleanisOnTrustedUriWhiteList(final URI uri)
Evaluates supplied address against a list of supported internet protocols allowed for use on hyperlinks.
if (uri == null || uri.getScheme() == null) {
    return false;
final String protocol = uri.getScheme().toLowerCase();
for (final String allowedProtocol : URI_SCHEME_WHITELIST) {
    if (protocol.equalsIgnoreCase(allowedProtocol)) {
        return true;
return false;
booleanisOriginForm(URI uri)
Determine if a uri is in origin-form according to rfc7230, 5.3.
return uri.getScheme() == null && uri.getSchemeSpecificPart() == null && uri.getHost() == null
        && uri.getAuthority() == null;
booleanisPrefix(final URI source, final URI other)
Checks whether the source URI is a prefix of the other URI.
if ((source.getScheme() == null && other.getScheme() != null)
        || !source.getScheme().equals(other.getScheme())) {
    return false;
final IPath sourcePath = new Path(source.getPath());
final IPath otherPath = new Path(other.getPath());
return sourcePath.isPrefixOf(otherPath);
booleanisProjectCacheURI(java.net.URI uri)
is Project Cache URI
return uri.getScheme().equalsIgnoreCase(CACHE_URI_SCHEME);
booleanisRedirectEndpointUriValid(String redirectUri)
According to OAuth 2, section 3.1.2 (Redirect Endpoint), a redirection endpoint MUST be an absolute URI and MUST not include a fragment component.
try {
    URI uri = new URI(redirectUri);
    return (uri.isAbsolute() && uri.getFragment() == null);
} catch (URISyntaxException e) {
    return false;
booleanisRedisSSLScheme(URI uri)
is Redis SSL Scheme
return REDISS.equals(uri.getScheme());
booleanisRemoteNamespace(URI ns)
is Remote Namespace
return ns.getScheme().equals("fab") && !ns.isOpaque();
booleanisResolvable(URI toCheck)
Determine if a URI is resolvable.
try {
    toCheck.toURL();
} catch (MalformedURLException e) {
    return false;
return true;
booleanisResource(URI uri)
is Resource
String scheme = uri.getScheme();
return scheme.equals("resource") || scheme.equals("classpath") || scheme.startsWith("jar");