private Server.Config _buildConfig() { Builder builder = this; if (_config.ports().isEmpty()) { builder = this._protocol(Protocol.HTTP, 0); } return builder._config; }
/** * Build the server and begin serving the provided routes as configured. * * @param block the router to use. * @return the actively running server. */ public Server build(Function<BuiltInComponents, Router> block) { Server.Config config = _buildConfig(); return new Server( JavaServerHelper.forRouter( JavaModeConverter.asScalaMode(config.mode()), OptionConverters.toScala(config.maybeHttpPort()), OptionConverters.toScala(config.maybeHttpsPort()), block ) ); }
/** * Build the server and begin serving the provided routes as configured. * * @param block the router to use. * @return the actively running server. */ public Server build(Function<BuiltInComponents, Router> block) { Server.Config config = _buildConfig(); return new Server( JavaServerHelper.forRouter( JavaModeConverter.asScalaMode(config.mode()), OptionConverters.toScala(config.maybeHttpPort()), OptionConverters.toScala(config.maybeHttpsPort()), block ) ); }
/** * Create a server for the router returned by the given block. * * @param block The block which creates a router. * @param mode The mode the server will run on. * @param port The port the server will run on. * * @return The running server. */ public static Server forRouter(Mode mode, int port, Function<BuiltInComponents, Router> block) { return new Builder() .mode(mode) .http(port) .build(block); }
/** * Create a server for the router returned by the given block. * * @param block The block which creates a router. * @param mode The mode the server will run on. * @param port The port the server will run on. * * @return The running server. */ public static Server forRouter(Mode mode, int port, Function<BuiltInComponents, Router> block) { return new Builder() .mode(mode) .http(port) .build(block); }
/** * Build the server and begin serving the provided routes as configured. * * @param router the router to use. * @return the actively running server. */ public Server build(final Router router) { return build((components) -> router); }
/** * Configure the server to serve HTTPS on a particular port. * * Passing 0 will make it serve on a random available port. * * @param port the port on which to serve ssl traffic * @return the builder with port set. */ public Builder https(int port) { return _protocol(Protocol.HTTPS, port); }
/** * Instruct the server to serve HTTP on a particular port. * * Passing 0 will make it serve on a random available port. * * @param port the port on which to serve http traffic * @return the builder with port set. */ public Builder http(int port) { return _protocol(Protocol.HTTP, port); }
/** * Instruct the server to serve HTTP on a particular port. * * Passing 0 will make it serve on a random available port. * * @param port the port on which to serve http traffic * @return the builder with port set. */ public Builder http(int port) { return _protocol(Protocol.HTTP, port); }
/** * Configure the server to serve HTTPS on a particular port. * * Passing 0 will make it serve on a random available port. * * @param port the port on which to serve ssl traffic * @return the builder with port set. */ public Builder https(int port) { return _protocol(Protocol.HTTPS, port); }
/** * Build the server and begin serving the provided routes as configured. * * @param router the router to use. * @return the actively running server. */ public Server build(final Router router) { return build((components) -> router); }
private Server.Config _buildConfig() { Builder builder = this; if (_config.ports().isEmpty()) { builder = this._protocol(Protocol.HTTP, 0); } return builder._config; }