private String assembleURI(final String scheme, final NetworkInterfaceBinding interfaceBinding, final int port, final int defaultPort, final HttpServerExchange exchange) throws URISyntaxException { final int p = (port != defaultPort ? port : -1); final String hostname = getRedirectHostname(interfaceBinding.getAddress(), exchange); if (hostname == null) { return NO_REDIRECT; } return new URI(scheme, null, hostname, p, CONSOLE_PATH, null, null).toString(); }
builder.advertise() .setAdvertiseSocketAddress(binding.getMulticastSocketAddress()) .setAdvertiseInterface(binding.getNetworkInterfaceBinding().getAddress()) if (!isMulticastEnabled(binding.getSocketBindings().getDefaultInterfaceBinding().getNetworkInterfaces())) { ROOT_LOGGER.multicastInterfaceNotAvailable();
static NetworkInterfaceBinding getNetworkInterfaceBinding(final String addr) throws UnknownHostException, SocketException { final InetAddress address = InetAddress.getByName(addr); final Collection<NetworkInterface> interfaces = new ArrayList<NetworkInterface>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { interfaces.add(networkInterfaces.nextElement()); } return new NetworkInterfaceBinding(interfaces, address); }
static NetworkInterfaceBinding getNetworkInterfaceBinding(final String addr) throws UnknownHostException, SocketException { final InetAddress address = InetAddress.getByName(addr); final Collection<NetworkInterface> interfaces = new ArrayList<NetworkInterface>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { interfaces.add(networkInterfaces.nextElement()); } return new NetworkInterfaceBinding(interfaces, address); }
/** * Returns the source address of this outbound socket binding if one is configured. If no explicit source address * is specified for this binding, then this method returns {@code null}. Use {@link #getSourceAddress()} * instead to obtain the default interface of the socket binding manager if none is specified for this binding. * * @return source address of this outbound socket binding if specified, * {@code null} otherwise */ public InetAddress getOptionalSourceAddress() { return sourceNetworkInterface != null ? sourceNetworkInterface.getAddress() : null; }
builder.advertise() .setAdvertiseSocketAddress(binding.getMulticastSocketAddress()) .setAdvertiseInterface(binding.getNetworkInterfaceBinding().getAddress()) if (!isMulticastEnabled(binding.getSocketBindings().getDefaultInterfaceBinding().getNetworkInterfaces())) { ROOT_LOGGER.multicastInterfaceNotAvailable();
static NetworkInterfaceBinding getNetworkInterfaceBinding(final String addr) throws UnknownHostException, SocketException { final InetAddress address = InetAddress.getByName(addr); final Collection<NetworkInterface> interfaces = new ArrayList<NetworkInterface>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { interfaces.add(networkInterfaces.nextElement()); } return new NetworkInterfaceBinding(interfaces, address); }
/** * Returns the source address of this outbound socket binding. If no explicit source address is specified * for this binding, then this method returns the address of the default interface that's configured * for the socket binding group * * @return */ public InetAddress getSourceAddress() { return this.sourceNetworkInterface != null ? this.sourceNetworkInterface.getAddress() : this.socketBindingManager.getDefaultInterfaceAddress(); }
static NetworkInterfaceBinding getNetworkInterfaceBinding(final String addr) throws UnknownHostException, SocketException { final InetAddress address = InetAddress.getByName(addr); final Collection<NetworkInterface> interfaces = new ArrayList<NetworkInterface>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { interfaces.add(networkInterfaces.nextElement()); } return new NetworkInterfaceBinding(interfaces, address); }
/** * Returns the source address of this outbound socket binding. If no explicit source address is specified * for this binding, then this method returns the address of the default interface that's configured * for the socket binding group. * * @return source address of this outbound socket binding if specified, * default interface of the socket binding manager otherwise */ public InetAddress getSourceAddress() { return this.sourceNetworkInterface != null ? this.sourceNetworkInterface.getAddress() : this.socketBindingManager.getDefaultInterfaceAddress(); }
private static NetworkInterfaceBinding resolveInterface(final OverallInterfaceCriteria criteria) throws SocketException { NetworkInterfaceBinding result = null; final Map<NetworkInterface, Set<InetAddress>> candidates = new HashMap<NetworkInterface, Set<InetAddress>>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { storeAddresses(networkInterfaces.nextElement(), candidates); } Map<NetworkInterface, Set<InetAddress>> acceptable = criteria.getAcceptableAddresses(candidates); if (acceptable.size() == 1 && acceptable.values().iterator().next().size() == 1) { // single result Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next(); InetAddress addr = entry.getValue().iterator().next(); result = new NetworkInterfaceBinding(Collections.singleton(entry.getKey()), addr); } return result; }
private String assembleURI(final String scheme, final NetworkInterfaceBinding interfaceBinding, final int port, final int defaultPort, final HttpServerExchange exchange) throws URISyntaxException { final int p = (port != defaultPort ? port : -1); final String hostname = getRedirectHostname(interfaceBinding.getAddress(), exchange); if (hostname == null) { return NO_REDIRECT; } return new URI(scheme, null, hostname, p, CONSOLE_PATH, null, null).toString(); }
private static NetworkInterfaceBinding resolveInterface(final OverallInterfaceCriteria criteria) throws SocketException { NetworkInterfaceBinding result = null; final Map<NetworkInterface, Set<InetAddress>> candidates = new HashMap<NetworkInterface, Set<InetAddress>>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { storeAddresses(networkInterfaces.nextElement(), candidates); } Map<NetworkInterface, Set<InetAddress>> acceptable = criteria.getAcceptableAddresses(candidates); if (acceptable.size() == 1 && acceptable.values().iterator().next().size() == 1) { // single result Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next(); InetAddress addr = entry.getValue().iterator().next(); result = new NetworkInterfaceBinding(Collections.singleton(entry.getKey()), addr); } return result; }
private String assembleURI(final String scheme, final NetworkInterfaceBinding interfaceBinding, final int port, final int defaultPort, final HttpServerExchange exchange) throws URISyntaxException { final int p = (port != defaultPort ? port : -1); final String hostname = getRedirectHostname(interfaceBinding.getAddress(), exchange); if (hostname == null) { return NO_REDIRECT; } return new URI(scheme, null, hostname, p, CONSOLE_PATH, null, null).toString(); }
private static NetworkInterfaceBinding resolveInterface(final OverallInterfaceCriteria criteria) throws SocketException { NetworkInterfaceBinding result = null; final Map<NetworkInterface, Set<InetAddress>> candidates = new HashMap<NetworkInterface, Set<InetAddress>>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { storeAddresses(networkInterfaces.nextElement(), candidates); } Map<NetworkInterface, Set<InetAddress>> acceptable = criteria.getAcceptableAddresses(candidates); if (acceptable.size() == 1 && acceptable.values().iterator().next().size() == 1) { // single result Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next(); InetAddress addr = entry.getValue().iterator().next(); result = new NetworkInterfaceBinding(Collections.singleton(entry.getKey()), addr); } return result; }
/** * Return the resolved {@link InetAddress} for this binding. * * @return the resolve address */ public InetAddress getAddress() { return networkInterface != null ? networkInterface.getAddress() : socketBindings.getDefaultInterfaceAddress(); }
private static NetworkInterfaceBinding resolveInterface(final OverallInterfaceCriteria criteria) throws SocketException { NetworkInterfaceBinding result = null; final Map<NetworkInterface, Set<InetAddress>> candidates = new HashMap<NetworkInterface, Set<InetAddress>>(); final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { storeAddresses(networkInterfaces.nextElement(), candidates); } Map<NetworkInterface, Set<InetAddress>> acceptable = criteria.getAcceptableAddresses(candidates); if (acceptable.size() == 1 && acceptable.values().iterator().next().size() == 1) { // single result Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next(); InetAddress addr = entry.getValue().iterator().next(); result = new NetworkInterfaceBinding(Collections.singleton(entry.getKey()), addr); } return result; }
/** * Return the resolved {@link InetAddress} for this binding. * * @return the resolve address */ public InetAddress getAddress() { return networkInterface != null ? networkInterface.getAddress() : socketBindings.getDefaultInterfaceAddress(); }
/** * Returns the source address of this outbound socket binding. If no explicit source address is specified * for this binding, then this method returns the address of the default interface that's configured * for the socket binding group * * @return */ public InetAddress getSourceAddress() { return this.sourceNetworkInterface != null ? this.sourceNetworkInterface.getAddress() : this.socketBindingManager.getDefaultInterfaceAddress(); }
/** * Return the resolved {@link InetAddress} for this binding. * * @return the resolve address */ public InetAddress getAddress() { return networkInterface != null ? networkInterface.getAddress() : socketBindings.getDefaultInterfaceAddress(); }