Test if hostName of the form container.service

@param uri schema URI
@return true if hostName of the form container.service
@throws IOException if error
972870
public static boolean validSchema(URI uri) throws IOException {
    LOG.trace("Checking schema {}", uri.toString());
    String hostName = Utils.getHost(uri);
    LOG.trace("Got hostname as {}", hostName);
    int i = hostName.lastIndexOf(".");
    if (i < 0) {
      return false;
    }
    String service = hostName.substring(i + 1);
    LOG.trace("Got service as {}", service);
    if (service.isEmpty() || service.contains(".")) {
      return false;
    }
    return true;
  }
544198
public void setURI(URI uri) throws URIException {

        if (uri.getScheme() == null || uri.getScheme().equals("")) {
            mUri = new URI(HTTP + "://" + getHeader(HOST) + "/" + mUri.toString(), true);
            
        } else {
            mUri = uri;
        }

        if (uri.getScheme().equalsIgnoreCase(HTTPS)) {
            mIsSecure = true;
            
        } else {
            mIsSecure = false;
        }

        setHostPort(mUri.getPort());
    }
354978
public static boolean uriCaseCheck(File file, String matchString) throws java.io.IOException {

        if (isCaseInsensitive || isWindows) { // security measure to ensure that this check is only performed on case
            // sensitive servers

            // begin 154268
            matchString = WSUtil.resolveURI(matchString);
            // (removed since it is changed to "//" inside of resolveURI
            // matchString = matchString.replace ('/', '\\'); // change string from
            // url format to Windows format
            // end 154268

            matchString = matchString.replace('/', File.separatorChar);
            String canPath = file.getCanonicalPath();
            // begin 540920 change for drive letter ignore case on Win 2008
            int offset = 0;
            int inx = matchString.length();
            if (isWindows && inx > 1 && canPath.length() > 0 && matchString.charAt(1) == ':') {
                // check that the string to match starts with a drive letter (':'), and
                // the drive letter is the same as canonical
                if (!(matchString.substring(0, 1).equalsIgnoreCase(canPath.substring(0, 1)))) {
                    return false;
                }
                // make the offset 1 for the regionMatches so that we do not compare the
                // drive letters
                offset = 1;
            }
            return canPath.regionMatches(canPath.length() - inx + offset, matchString, offset, inx - offset);
            // end 540920
        }
        return true;
    }
266954
public static boolean isHdfsUri(URI endpoint)
    {
        final String path = endpoint.getPath();
        if (path != null && path.indexOf('/', 1) != -1) {
            return path.substring(1, path.indexOf('/', 1)).equalsIgnoreCase("webhdfs");
        } else {
            return false;
        }
    }
999249
private boolean isServiceSupportedInRegion(String serviceName) {
        return partition.getServices().get(serviceName) != null
                && partition.getServices().get(serviceName).getEndpoints()
                .containsKey(region);
    }
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;
    }
974026
public static String getHost(final URI uri) throws NormalizationException {
        final String host = Strings.emptyToNull(uri.getHost());
        if (host == null) {
            throw new NormalizationException(uri.toString(), "No host in URI");
        }
        return host;
    }
41498
protected boolean isTargetUriInScope(String uri) {
		if (uri == null) {
			return false;
		}
		return getModel().getSession().isInScope(uri);
	}
263832
public boolean isLocalSipURI(SipURI uri) {
		checkState();
		// XXX: InetAddress api is
		// crude.....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
		ListeningPoint lp = this.provider.getListeningPoint(uri
				.getTransportParam());
		if (lp != null && lp.getIPAddress().equals(uri.getHost())
				&& lp.getPort() == uri.getPort()) {
			return true;
		} else {
			if (tracer.isFineEnabled()) {
				tracer.fine("Passed uri not local? Passed URI[" + uri
						+ "] doesnt match lp[" + lp + "]");
			}

			return false;
		}
	}
714568
protected static boolean isAPIUri(Uri uri) {
        if (uri == null) {
            return false;
        }

        return getBaseUri().getHost().equals(uri.getHost());
    }
1325555
public static boolean isURLFedoraServer(String url) {

        // scheme must be http or https
        URI uri = URI.create(url);
        String scheme = uri.getScheme();
        if (!scheme.equals("http") && !scheme.equals("https")) {
            return false;
        }

        // host must be configured hostname or localhost
        String fHost = CONFIG.getParameter(FEDORA_SERVER_HOST,Parameter.class).getValue();
        String host = uri.getHost();
        if (!host.equals(fHost) && !host.equals("localhost")) {
            return false;
        }

        // path must begin with configured webapp context
        String path = uri.getPath();
        String fedoraContext = CONFIG.getParameter(
                FEDORA_SERVER_CONTEXT,Parameter.class).getValue();
        if (!path.startsWith("/" + fedoraContext + "/")) {
            return false;
        }

        // port specification must match http or https port as appropriate
        String httpPort = CONFIG.getParameter(FEDORA_SERVER_PORT,Parameter.class).getValue();
        String httpsPort = CONFIG.getParameter(FEDORA_REDIRECT_PORT,Parameter.class).getValue();
        if (uri.getPort() == -1) {
            // unspecified, so fedoraPort must be 80 (http), or 443 (https)
            if (scheme.equals("http")) {
                return httpPort.equals("80");
            } else {
                return httpsPort.equals("443");
            }
        } else {
            // specified, so must match appropriate http or https port
            String port = "" + uri.getPort();
            if (scheme.equals("http")) {
                return port.equals(httpPort);
            } else {
                return port.equals(httpsPort);
            }
        }

    }
493471
public UriComponentsBuilder uri(URI uri) {
		Assert.notNull(uri, "'uri' must not be null");
		this.scheme = uri.getScheme();
		if (uri.isOpaque()) {
			this.ssp = uri.getRawSchemeSpecificPart();
			resetHierarchicalComponents();
		}
		else {
			if (uri.getRawUserInfo() != null) {
				this.userInfo = uri.getRawUserInfo();
			}
			if (uri.getHost() != null) {
				this.host = uri.getHost();
			}
			if (uri.getPort() != -1) {
				this.port = String.valueOf(uri.getPort());
			}
			if (StringUtils.hasLength(uri.getRawPath())) {
				this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
			}
			if (StringUtils.hasLength(uri.getRawQuery())) {
				this.queryParams.clear();
				query(uri.getRawQuery());
			}
			resetSchemeSpecificPart();
		}
		if (uri.getRawFragment() != null) {
			this.fragment = uri.getRawFragment();
		}
		return this;
	}
857499
public static boolean isAbsoluteURI( String uri )
    {
         //
         // This method needs to be fast, so it can't use java.net.URI.
         //
         if ( uri.length() == 0 || uri.charAt( 0 ) == '/' ) return false;
        
         for ( int i = 0, len = uri.length(); i < len; ++i )
         {
             char c = uri.charAt( i );
            
             if ( c == ':' )
             {
                 return true;
             }
             else if ( c == '/' )
             {
                 return false;
             }
         }
        
         return false;
     }
558194
public synchronized boolean isAllowedHost(String host) {
    boolean isIncluded = includes.isEmpty() || includes.contains(host);
    boolean isExcluded = excludes.contains(host);
    return isIncluded && !isExcluded;
  }
1280424
static boolean isValidHostNameForSNI(String hostname) {
        return hostname != null &&
               hostname.indexOf('.') > 0 &&
               !hostname.endsWith(".") &&
               !NetUtil.isValidIpV4Address(hostname) &&
               !NetUtil.isValidIpV6Address(hostname);
    }
929543
@Override
    public boolean serviceExists(URI serviceUri) throws ServiceException {
        if (serviceUri == null || !serviceUri.isAbsolute()) {
            log.warn("The Service URI is either absent or relative. Provide an absolute URI");
            return false;
        }

        URI graphUri;
        try {
            graphUri = getGraphUriForElement(serviceUri);
        } catch (URISyntaxException e) {
            log.warn("The namespace of the URI of the message content is incorrect.", e);
            return Boolean.FALSE;
        }

        if (graphUri == null) {
            log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri);
            return Boolean.FALSE;
        }

        String queryStr = new StringBuilder()
                .append("ASK { \n")
                .append("GRAPH <").append(graphUri.toASCIIString()).append("> {")
                .append("<").append(serviceUri.toASCIIString()).append("> <").append(RDF.type.getURI()).append("> <").append(MSM.Service).append("> }\n}").toString();

        Query query = QueryFactory.create(queryStr);
        QueryExecution qe = QueryExecutionFactory.sparqlService(this.graphStoreManager.getSparqlQueryEndpoint().toASCIIString(), query);
        MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe);
        try {
            return qexec.execAsk();
        } finally {
            qexec.close();
        }
    }
1027471
protected boolean isForbidden(URI uri)
    {
        String scheme = uri.getScheme();
        String host = uri.getHost();
        int port = uri.getPort();
        return isForbidden(scheme, host, port, true);
    }