List of utility methods to do URL to Host Name
String | getHost(String url) Returns the hostname or ip address portion of a url. try { URL u = new URL(url); return u.getHost(); } catch (Exception e) { return url; |
String | getHost(String url) Returns the lowercased hostname for the url or null if the url is not well formed. try { return new URL(url).getHost().toLowerCase(); } catch (MalformedURLException e) { return null; |
String | getHost(String url) Parses URL and get host from it, if it is possible if (url.contains("://")) { URI uri = URI.create(url); return uri.getHost(); } else if (GIT_URL_PATTERN.matcher(url).matches()) { return url.substring(url.indexOf("@") + 1, url.indexOf(":")); } else { return null; |
String | getHost(String url) get Host URI uri = null; try { uri = new URI(url); } catch (URISyntaxException e) { System.out.println("Omg, It's not a valid URL: " + url); return ""; String host = uri.getHost(); ... |
String | getHost(String url) get Host if (isEmpty(url)) { return url; String host = null; if (url.contains(SCHEME_SEPARATOR)) { try { host = new URI(url).getHost(); } catch (URISyntaxException ignored) { ... |
String | getHost(String urlString) get Host try { URL url = new URL(urlString); return url.getHost(); } catch (MalformedURLException e) { throw e; |
String | getHost(String urlString) Retrieves the host from a URL {Category} StringUtil {param} string(url) url: String. if (urlString == null) { return null; urlString = urlString.trim().toLowerCase(); if (urlString.startsWith("http://") == false) { urlString = "http://" + urlString; String decUrl = null; ... |
String | getHost(URL url) get Host return url.getHost() + ":" + (url.getProtocol().equals("http") ? 80 : url.getPort()); |
byte[] | getHostAddressAsBytes(String url) Returns the Host Address of a given URL as byte[]. return InetAddress.getByName(getHostAddress(url)).getAddress();
|
String | getHostAndPort(final URL url) get Host And Port return url.getHost() + ":" + getSanitizedPort(url); |