Package play.server
Class Server.Builder
- Object
-
- play.server.Server.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Server
build(Function<BuiltInComponents,Router> block)
Build the server and begin serving the provided routes as configured.Server
build(Router router)
Build the server and begin serving the provided routes as configured.Server.Builder
http(int port)
Instruct the server to serve HTTP on a particular port.Server.Builder
https(int port)
Configure the server to serve HTTPS on a particular port.Server.Builder
mode(Mode mode)
Set the mode the server should be run on (defaults to TEST)
-
-
-
Method Detail
-
http
public Server.Builder http(int port)
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
public Server.Builder https(int port)
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
public Server.Builder mode(Mode 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
public Server build(Router router)
Build the server and begin serving the provided routes as configured.- Parameters:
router
- the router to use.- Returns:
- the actively running server.
-
build
public Server build(Function<BuiltInComponents,Router> block)
Build the server and begin serving the provided routes as configured.- Parameters:
block
- the router to use.- Returns:
- the actively running server.
-
-