/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since org.apache.activemq.artemis.shaded.com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since org.apache.activemq.artemis.shaded.com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since org.apache.activemq.artemis.shaded.com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }
/** * It will enclose an IPV6 host with [], that we need before building URIs */ public static String encloseHost(final String host) { // if the host contains a ':' then we know it's not IPv4 if (host != null && host.contains(":")) { String hostToCheck = host; /* strip off zone index since com.google.common.net.InetAddresses.isInetAddress() doesn't support it * see https://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices for more info */ if (host.contains("%")) { hostToCheck = host.substring(0, host.indexOf("%")); } if (InetAddresses.isInetAddress(hostToCheck)) { return "[" + host + "]"; } } return host; }