Package play.server
Class Server
java.lang.Object
play.server.Server
A Play server.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfigures and builds an embedded server.static enumSpecifies the protocols supported by the server. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ServerforRouter(int port, Function<BuiltInComponents, Router> block) Create a server for the given router.static ServerforRouter(Function<BuiltInComponents, Router> block) Create a server for the given router.static ServerforRouter(Mode mode, int port, Function<BuiltInComponents, Router> block) Create a server for the router returned by the given block.static ServerforRouter(Mode mode, Function<BuiltInComponents, Router> block) Create a server for the given router.inthttpPort()Get the HTTP port the server is running on.intGet the HTTPS port the server is running on.Get the address the server is running on.voidstop()Stop the server.play.core.server.Server
-
Constructor Details
-
Server
public Server(play.core.server.Server server)
-
-
Method Details
-
underlying
public play.core.server.Server underlying()- Returns:
- the underlying server.
-
stop
public void stop()Stop the server. -
httpPort
public int httpPort()Get the HTTP port the server is running on.- Returns:
- the port number.
- Throws:
IllegalStateException- if it is not running on the HTTP protocol
-
httpsPort
public int httpsPort()Get the HTTPS port the server is running on.- Returns:
- the port number.
- Throws:
IllegalStateException- if it is not running on the HTTPS protocol.
-
mainAddress
Get the address the server is running on.- Returns:
- the address
-
forRouter
Create a server for the given router.The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort property.
The server will be running in TEST mode.
- Parameters:
block- The block that creates the router.- Returns:
- The running server.
-
forRouter
Create a server for the given router.The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort property.
The server will be running in TEST mode.
- Parameters:
mode- The mode the server will run on.block- The block that creates the router.- Returns:
- The running server.
-
forRouter
Create a server for the given router.The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort property.
The server will be running in TEST mode.
- Parameters:
port- The port the server will run on.block- The block that creates the router.- Returns:
- The running server.
-
forRouter
Create a server for the router returned by the given block.- Parameters:
block- The block which creates a router.mode- The mode the server will run on.port- The port the server will run on.- Returns:
- The running server.
-