Example usage for com.squareup.okhttp HttpUrl host

List of usage examples for com.squareup.okhttp HttpUrl host

Introduction

In this page you can find the example usage for com.squareup.okhttp HttpUrl host.

Prototype

String host

To view the source code for com.squareup.okhttp HttpUrl host.

Click Source Link

Document

Canonical hostname.

Usage

From source file:net.yatomiya.e4.util.HttpUtils.java

License:Open Source License

public static String getHost(String url) {
    try {/*from   ww w.j av a 2 s  . c o m*/
        HttpUrl hurl = HttpUrl.parse(url);
        return hurl.host();
    } catch (Throwable e) {
        return null;
    }
}

From source file:net.yatomiya.e4.util.HttpUtils.java

License:Open Source License

public static String getHostUrl(String url) {
    try {/* w  w w  .j a v  a  2  s  . c  o  m*/
        HttpUrl hurl = HttpUrl.parse(url);
        return hurl.scheme() + "://" + hurl.host();
    } catch (Throwable e) {
        return null;
    }
}