Example usage for com.squareup.okhttp HttpUrl defaultPort

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

Introduction

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

Prototype

public static int defaultPort(String scheme) 

Source Link

Document

Returns 80 if scheme.equals("http") , 443 if scheme.equals("https") and -1 otherwise.

Usage

From source file:com.baidu.oped.apm.plugin.okhttp.interceptor.HttpEngineSendRequestMethodInterceptor.java

License:Apache License

private String getDestinationId(HttpUrl httpUrl) {
    if (httpUrl == null || httpUrl.host() == null) {
        return "UnknownHttpClient";
    }//  www. j a v  a2s  . c o  m
    if (httpUrl.port() == HttpUrl.defaultPort(httpUrl.scheme())) {
        return httpUrl.host();
    }
    final StringBuilder sb = new StringBuilder();
    sb.append(httpUrl.host());
    sb.append(':');
    sb.append(httpUrl.port());
    return sb.toString();
}

From source file:com.navercorp.pinpoint.plugin.okhttp.interceptor.RequestBuilderBuildMethodInterceptor.java

License:Apache License

private String getDestinationId(HttpUrl httpUrl) {
    if (httpUrl == null || httpUrl.host() == null) {
        return "UnknownHttpClient";
    }// ww  w . j a v  a  2 s . c o  m
    if (httpUrl.port() <= 0 || httpUrl.port() == HttpUrl.defaultPort(httpUrl.scheme())) {
        return httpUrl.host();
    }
    final StringBuilder sb = new StringBuilder();
    sb.append(httpUrl.host());
    sb.append(':');
    sb.append(httpUrl.port());
    return sb.toString();
}

From source file:com.navercorp.pinpoint.plugin.okhttp.v2.interceptor.RequestBuilderBuildMethodInterceptor.java

License:Apache License

private String getDestinationId(HttpUrl httpUrl) {
    if (httpUrl == null || httpUrl.host() == null) {
        return "UnknownHttpClient";
    }// w w w.j  a v  a2  s. c  om
    final int port = EndPointUtils.getPort(httpUrl.port(), HttpUrl.defaultPort(httpUrl.scheme()));
    return HostAndPort.toHostAndPortString(httpUrl.host(), port);
}