1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 package org.chromium.net;
7 import org.chromium.base.JNINamespace;
10 * Class to access the GURL library from java.
13 public final class GURLUtils {
16 * Get the origin of an url: Ex getOrigin("http://www.example.com:8080/index.html?bar=foo")
17 * would return "http://www.example.com:8080". It will return an empty string for an
20 * @return The origin of the url
22 public static String getOrigin(String url) {
23 return nativeGetOrigin(url);
27 * Get the scheme of the url (e.g. http, https, file). The returned string
28 * contains everything before the "://".
30 * @return The scheme of the url.
32 public static String getScheme(String url) {
33 return nativeGetScheme(url);
36 private static native String nativeGetOrigin(String url);
37 private static native String nativeGetScheme(String url);