/** * Adds a new {@link ServerPort} that listens to the specified {@code port} of all available network * interfaces using the specified protocol. * * @deprecated Use {@link #http(int)} or {@link #https(int)}. * @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a> */ @Deprecated public ServerBuilder port(int port, String protocol) { return port(port, SessionProtocol.of(requireNonNull(protocol, "protocol"))); }
/** * Adds an HTTP port that listens to the specified {@code localAddress}. * * @param localAddress the local address to bind * * @see #http(int) * @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a> */ public ServerBuilder http(InetSocketAddress localAddress) { return port(new ServerPort(requireNonNull(localAddress, "localAddress"), HTTP)); }
/** * Adds an HTTPS port that listens on all available network interfaces. * * @param port the HTTPS port number. * * @see #https(InetSocketAddress) * @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a> */ public ServerBuilder https(int port) { return port(new ServerPort(port, HTTPS)); }
/** * Adds an HTTP port that listens on all available network interfaces. * * @param port the HTTP port number. * * @see #http(InetSocketAddress) * @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a> */ public ServerBuilder http(int port) { return port(new ServerPort(port, HTTP)); }
/** * Adds an HTTPS port that listens to the specified {@code localAddress}. * * @param localAddress the local address to bind * * @see #http(int) * @see <a href="#no_port_specified">What happens if no HTTP(S) port is specified?</a> */ public ServerBuilder https(InetSocketAddress localAddress) { return port(new ServerPort(requireNonNull(localAddress, "localAddress"), HTTPS)); }
/** * Adds a new {@link ServerPort} that listens to the specified {@code localAddress} using the specified * protocol. * * @deprecated Use {@link #http(InetSocketAddress)} or {@link #https(InetSocketAddress)}. */ @Deprecated public ServerBuilder port(InetSocketAddress localAddress, String protocol) { return port(localAddress, SessionProtocol.of(requireNonNull(protocol, "protocol"))); }
/** * Adds a new {@link ServerPort} that listens to the specified {@code localAddress} using the specified * {@link SessionProtocol}s. Specify multiple protocols to serve more than one protocol on the same port: * * <pre>{@code * ServerBuilder sb = new ServerBuilder(); * // Serve both HTTP and HTTPS at port 8080. * sb.port(new InetSocketAddress(8080), * SessionProtocol.HTTP, * SessionProtocol.HTTPS); * // Enable HTTPS with PROXY protocol support at port 8443. * sb.port(new InetSocketAddress(8443), * SessionProtocol.PROXY, * SessionProtocol.HTTPS); * }</pre> */ public ServerBuilder port(InetSocketAddress localAddress, SessionProtocol... protocols) { return port(new ServerPort(localAddress, protocols)); }
/** * Adds a new {@link ServerPort} that listens to the specified {@code localAddress} using the specified * {@link SessionProtocol}s. Specify multiple protocols to serve more than one protocol on the same port: * * <pre>{@code * ServerBuilder sb = new ServerBuilder(); * // Serve both HTTP and HTTPS at port 8080. * sb.port(new InetSocketAddress(8080), * Arrays.asList(SessionProtocol.HTTP, * SessionProtocol.HTTPS)); * // Enable HTTPS with PROXY protocol support at port 8443. * sb.port(new InetSocketAddress(8443), * Arrays.asList(SessionProtocol.PROXY, * SessionProtocol.HTTPS)); * }</pre> */ public ServerBuilder port(InetSocketAddress localAddress, Iterable<SessionProtocol> protocols) { return port(new ServerPort(localAddress, protocols)); }
/** * Adds a new {@link ServerPort} that listens to the specified {@code port} of all available network * interfaces using the specified {@link SessionProtocol}s. Specify multiple protocols to serve more than * one protocol on the same port: * * <pre>{@code * ServerBuilder sb = new ServerBuilder(); * // Serve both HTTP and HTTPS at port 8080. * sb.port(8080, * Arrays.asList(SessionProtocol.HTTP, * SessionProtocol.HTTPS)); * // Enable HTTPS with PROXY protocol support at port 8443. * sb.port(8443, * Arrays.asList(SessionProtocol.PROXY, * SessionProtocol.HTTPS)); * }</pre> */ public ServerBuilder port(int port, Iterable<SessionProtocol> protocols) { return port(new ServerPort(port, protocols)); }
/** * Adds a new {@link ServerPort} that listens to the specified {@code port} of all available network * interfaces using the specified {@link SessionProtocol}s. Specify multiple protocols to serve more than * one protocol on the same port: * * <pre>{@code * ServerBuilder sb = new ServerBuilder(); * // Serve both HTTP and HTTPS at port 8080. * sb.port(8080, * SessionProtocol.HTTP, * SessionProtocol.HTTPS); * // Enable HTTPS with PROXY protocol support at port 8443. * sb.port(8443, * SessionProtocol.PROXY, * SessionProtocol.HTTPS); * }</pre> */ public ServerBuilder port(int port, SessionProtocol... protocols) { return port(new ServerPort(port, protocols)); }
server.port(new ServerPort(port, protocols)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), protocols)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), protocols)); } catch (UnknownHostException e) {
server.port(new ServerPort(port, protocols)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), protocols)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), protocols)); } catch (UnknownHostException e) {
server.port(new ServerPort(DEFAULT_PORT.getPort(), DEFAULT_PORT.getProtocols())); } else { configurePorts(server, ports);
private static void configurePorts(ArmeriaSettings armeriaSettings, ServerBuilder server) { if (armeriaSettings.getPorts().isEmpty()) { server.port(new ServerPort(DEFAULT_PORT.getPort(), DEFAULT_PORT.getProtocol())); return; server.port(new ServerPort(port, proto)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), proto)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), proto)); } catch (UnknownHostException e) {
private static void configurePorts(ArmeriaSettings armeriaSettings, ServerBuilder server) { if (armeriaSettings.getPorts().isEmpty()) { server.port(new ServerPort(DEFAULT_PORT.getPort(), DEFAULT_PORT.getProtocol())); return; server.port(new ServerPort(port, proto)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), proto)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), proto)); } catch (UnknownHostException e) {
private static void configurePorts(ArmeriaSettings armeriaSettings, ServerBuilder server) { if (armeriaSettings.getPorts().isEmpty()) { server.port(new ServerPort(DEFAULT_PORT.getPort(), DEFAULT_PORT.getProtocol())); return; server.port(new ServerPort(port, proto)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), proto)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), proto)); } catch (UnknownHostException e) {
private static void configurePorts(ArmeriaSettings armeriaSettings, ServerBuilder server) { if (armeriaSettings.getPorts().isEmpty()) { server.port(new ServerPort(DEFAULT_PORT.getPort(), DEFAULT_PORT.getProtocol())); return; server.port(new ServerPort(port, proto)); } else { try { final Enumeration<InetAddress> e = NetworkInterface.getByName(iface).getInetAddresses(); while (e.hasMoreElements()) { server.port(new ServerPort(new InetSocketAddress(e.nextElement(), port), proto)); final byte[] bytes = NetUtil.createByteArrayFromIpAddressString(ip); try { server.port(new ServerPort(new InetSocketAddress( InetAddress.getByAddress(bytes), port), proto)); } catch (UnknownHostException e) {