Android URL Parse getOrigin(String url)

Here you can find the source of getOrigin(String url)

Description

Get the origin of an url: Ex getOrigin("http://www.example.com:8080/index.html?bar=foo") would return "http://www.example.com:8080".

License

Open Source License

Return

The origin of the url

Declaration

public static String getOrigin(String url) 

Method Source Code

//package com.java2s;
// Use of this source code is governed by a BSD-style license that can be

public class Main {
    /**//from w w  w .  j  av a  2 s  .c o m
     * Get the origin of an url: Ex getOrigin("http://www.example.com:8080/index.html?bar=foo")
     * would return "http://www.example.com:8080". It will return an empty string for an
     * invalid url.
     *
     * @return The origin of the url
     */
    public static String getOrigin(String url) {
        return nativeGetOrigin(url);
    }

    private static native String nativeGetOrigin(String url);
}

Related

  1. parseHttpParamsToHash(String s)
  2. getHost(String url)
  3. getNormalizedURLString(String url)
  4. getParentUrl(String url)
  5. getRecentMediaUrl(String tag)
  6. getStringFromUrl(String url)
  7. getUrlContent(String urlStr)