List of utility methods to do Host Name Get
String | getLocalCanonicalHostName() get Local Canonical Host Name InetAddress localMachine = InetAddress.getLocalHost();
return localMachine.getCanonicalHostName();
|
String | getLocalShortHostName() get Local Short Host Name if (cachedShortHostName != null) { return cachedShortHostName; try { String hostName; InetAddress iAddress = InetAddress.getLocalHost(); hostName = iAddress.getHostName(); String[] parts = hostName.split("\\."); ... |
String | getLogHost() get Log Host InetAddress address = LOCAL_ADDRESS;
return address == null ? LOCALHOST : address.getHostAddress();
|
String | getMachineHostname() get Machine Hostname try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { return "unknown"; |
String | getMyHostname() get My Hostname String hostName = null; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (final UnknownHostException e) { try { final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { final NetworkInterface nic = interfaces.nextElement(); ... |
Proxy | getProxy(String host, String proxyType) get Proxy Proxy foundProxy = null; try { URI uri = new URI(proxyType, "//" + host, null); List<Proxy> proxies = ProxySelector.getDefault().select(uri); if (proxies != null) { for (Proxy proxy : proxies) { if (proxy != Proxy.NO_PROXY) { foundProxy = proxy; ... |
String | getServerHost() get Server Host final String host = System.getProperty("node0", "localhost"); return toIPv6URLFormat(host); |
String | getShortHostName() get the current host name String hostname = null; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { e.printStackTrace(); return hostname; |
String | getShortHostName() get Short Host Name String name = getHostName(); int i = name.indexOf('.'); if (i == -1) return name; return name.substring(0, i); |
String | getShortHostname() get Short Hostname return getFullHostname().replaceAll("\\..*", ""); |