public class Server
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Server.Builder
Configures and builds an embedded server.
|
static class |
Server.Protocol
Specifies the protocols supported by the server.
|
Constructor and Description |
---|
Server(play.core.server.Server server) |
Modifier and Type | Method and Description |
---|---|
static Server |
forRouter(java.util.function.Function<BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(int port,
java.util.function.Function<BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(Mode mode,
java.util.function.Function<BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(Mode mode,
int port,
java.util.function.Function<BuiltInComponents,Router> block)
Create a server for the router returned by the given block.
|
int |
httpPort()
Get the HTTP port the server is running on.
|
int |
httpsPort()
Get the HTTPS port the server is running on.
|
java.net.InetSocketAddress |
mainAddress()
Get the address the server is running on.
|
void |
stop()
Stop the server.
|
play.core.server.Server |
underlying() |
public play.core.server.Server underlying()
public void stop()
public int httpPort()
java.lang.IllegalStateException
- if it is not running on the HTTP protocolpublic int httpsPort()
java.lang.IllegalStateException
- if it is not running on the HTTPS protocol.public java.net.InetSocketAddress mainAddress()
public static Server forRouter(java.util.function.Function<BuiltInComponents,Router> block)
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.
block
- The block that creates the router.public static Server forRouter(Mode mode, java.util.function.Function<BuiltInComponents,Router> block)
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.
mode
- The mode the server will run on.block
- The block that creates the router.public static Server forRouter(int port, java.util.function.Function<BuiltInComponents,Router> block)
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.
port
- The port the server will run on.block
- The block that creates the router.public static Server forRouter(Mode mode, int port, java.util.function.Function<BuiltInComponents,Router> block)
block
- The block which creates a router.mode
- The mode the server will run on.port
- The port the server will run on.