@Test public void testGetExplicitPort() { String url = "http: Uri uri = Uri.create(url); assertEquals(uri.getExplicitPort(), 80, "getExplicitPort should return port 80 for http url when port is not specified in url"); String url2 = "http: Uri uri2 = Uri.create(url2); assertEquals(uri2.getExplicitPort(), 8080, "getExplicitPort should return the port given in the url"); }
public int getExplicitPort() { return port == -1 ? getSchemeDefaultPort() : port; }
Uri { public int getExplicitPort() { return port == -1 ? getSchemeDefaultPort() : port; } }
Uri { public int getExplicitPort() { return port == -1 ? getSchemeDefaultPort() : port; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); }
Uri { public int getExplicitPort() { return port == -1 ? getSchemeDefaultPort() : port; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); static Uri create(String originalUrl); static Uri create(Uri context, final String originalUrl); String getQuery(); String getPath(); String getUserInfo(); int getPort(); String getScheme(); String getHost(); String getFragment(); boolean isSecured(); boolean isWebSocket(); URI toJavaNetURI(); int getExplicitPort(); int getSchemeDefaultPort(); String toUrl(); String toBaseUrl(); String toRelativeUrl(); String toFullUrl(); String getBaseUrl(); String getAuthority(); boolean isSameBase(Uri other); String getNonEmptyPath(); @Override String toString(); Uri withNewScheme(String newScheme); Uri withNewQuery(String newQuery); @Override int hashCode(); @Override boolean equals(Object obj); static void validateSupportedScheme(Uri uri); }
Uri { public int getExplicitPort() { return port == -1 ? getSchemeDefaultPort() : port; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); static Uri create(String originalUrl); static Uri create(Uri context, final String originalUrl); String getQuery(); String getPath(); String getUserInfo(); int getPort(); String getScheme(); String getHost(); String getFragment(); boolean isSecured(); boolean isWebSocket(); URI toJavaNetURI(); int getExplicitPort(); int getSchemeDefaultPort(); String toUrl(); String toBaseUrl(); String toRelativeUrl(); String toFullUrl(); String getBaseUrl(); String getAuthority(); boolean isSameBase(Uri other); String getNonEmptyPath(); @Override String toString(); Uri withNewScheme(String newScheme); Uri withNewQuery(String newQuery); @Override int hashCode(); @Override boolean equals(Object obj); static void validateSupportedScheme(Uri uri); static final String HTTP; static final String HTTPS; static final String WS; static final String WSS; }