Java URI Value Check isResourceLocalToServer(URI resourceUri, URI serverUri)

Here you can find the source of isResourceLocalToServer(URI resourceUri, URI serverUri)

Description

Figure out whether the URI is actually local to the server.

License

Apache License

Parameter

Parameter Description
resourceUri a parameter
serverUri the server URI

Declaration

public static boolean isResourceLocalToServer(URI resourceUri, URI serverUri) 

Method Source Code


//package com.java2s;
/*/*from w  w w .  ja  va  2s  .  c  o  m*/
 * Copyright (c) 2013. Knowledge Media Institute - The Open University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.net.URI;

public class Main {
    /**
     * Figure out whether the URI is actually local to the server. That is,
     * it tells whether the resouce is controlled by the server.
     *
     * @param resourceUri
     * @param serverUri   the server URI
     * @return
     */
    public static boolean isResourceLocalToServer(URI resourceUri, URI serverUri) {
        URI relativeUri = serverUri.relativize(resourceUri);
        return !relativeUri.isAbsolute();
    }
}

Related

  1. isRedirectEndpointUriValid(String redirectUri)
  2. isRedisSSLScheme(URI uri)
  3. isRemoteNamespace(URI ns)
  4. isResolvable(URI toCheck)
  5. isResource(URI uri)
  6. isRoot(URI base)
  7. isRoot(URI uri)
  8. isSecure(final URI uri)
  9. isSecure(URI uri)