/** * Create a server for the given router. * <p> * The server will be running in TEST mode. * * @param router The router for the server to serve. * @param port The port the server will run on. * @return The running server. */ public static Server forRouter(Router router, int port) { return forRouter(router, Mode.TEST, port); }
/** * Set the mode the server should be run on (defaults to TEST) * * @param mode the Play mode (dev, prod, test) * @return the builder with Server.Config set to mode. */ public Builder mode(Mode mode) { _config = new Server.Config(_config.ports(), mode); return this; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * * @param router The router for the server to serve. * @param mode The mode the server will run on. * @return The running server. */ public static Server forRouter(Router router, Mode mode) { return forRouter(router, mode, 0); }
/** * 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); }
/** * Set the mode the server should be run on (defaults to TEST) * * @param mode the Play mode (dev, prod, test) * @return the builder with Server.Config set to mode. */ public Builder mode(Mode mode) { _config = new Server.Config(_config.ports(), mode); return this; }
/** * 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); }
/** * 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); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param mode The mode the server will run on. * @param block The block that creates the router. * @return The running server. */ public static Server forRouter(Mode mode, Function<BuiltInComponents, Router> block) { return forRouter(mode, 0, block); }
/** * 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); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param block The block that creates the router. * @return The running server. */ public static Server forRouter(Function<BuiltInComponents, Router> block) { return forRouter(Mode.TEST, 0, block); }
/** * 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); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param mode The mode the server will run on. * @param block The block that creates the router. * @return The running server. */ public static Server forRouter(Mode mode, Function<BuiltInComponents, Router> block) { return forRouter(mode, 0, block); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param router The router for the server to serve. * @return The running server. */ public static Server forRouter(Router router) { return forRouter(router, Mode.TEST, 0); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param block The block that creates the router. * @return The running server. */ public static Server forRouter(Function<BuiltInComponents, Router> block) { return forRouter(Mode.TEST, 0, block); }
/** * Create a server for the given router. * <p> * The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort * property. * <p> * The server will be running in TEST mode. * * @param port The port the server will run on. * @param block The block that creates the router. * @return The running server. */ public static Server forRouter(int port, Function<BuiltInComponents, Router> block) { return forRouter(Mode.TEST, port, block); }