Package play.server
Class Server.Builder
java.lang.Object
play.server.Server.Builder
- Enclosing class:
- Server
Configures and builds an embedded server. If not further configured, it will default to serving
TEST mode over HTTP on a random available port.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild(Function<BuiltInComponents, Router> block) Build the server and begin serving the provided routes as configured.Build the server and begin serving the provided routes as configured.http(int port) Instruct the server to serve HTTP on a particular port.https(int port) Configure the server to serve HTTPS on a particular port.Set the mode the server should be run on (defaults to TEST)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
http
Instruct the server to serve HTTP on a particular port.Passing 0 will make it serve on a random available port.
- Parameters:
port- the port on which to serve http traffic- Returns:
- the builder with port set.
-
https
Configure the server to serve HTTPS on a particular port.Passing 0 will make it serve on a random available port.
- Parameters:
port- the port on which to serve ssl traffic- Returns:
- the builder with port set.
-
mode
Set the mode the server should be run on (defaults to TEST)- Parameters:
mode- the Play mode (dev, prod, test)- Returns:
- the builder with Server.Config set to mode.
-
build
Build the server and begin serving the provided routes as configured.- Parameters:
router- the router to use.- Returns:
- the actively running server.
-
build
Build the server and begin serving the provided routes as configured.- Parameters:
block- the router to use.- Returns:
- the actively running server.
-