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<play.api.BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(int port,
java.util.function.Function<play.api.BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(Mode mode,
java.util.function.Function<play.api.BuiltInComponents,Router> block)
Create a server for the given router.
|
static Server |
forRouter(Mode mode,
int port,
java.util.function.Function<play.api.BuiltInComponents,Router> block)
Create a server for the router returned by the given block.
|
static Server |
forRouter(Router router)
Deprecated.
As of 2.6.0. Use
forRouter(Function) |
static Server |
forRouter(Router router,
int port)
Deprecated.
As of 2.6.0. Use
forRouter(int, Function) |
static Server |
forRouter(Router router,
Mode mode)
Deprecated.
As of 2.6.0. Use
forRouter(Mode, Function) |
static Server |
forRouter(Router router,
Mode mode,
int port)
Deprecated.
As of 2.6.0. Use
forRouter(Mode, int, Function) |
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()
@Deprecated public static Server forRouter(Router router)
forRouter(Function)
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.
router
- The router for the server to serve.public static Server forRouter(java.util.function.Function<play.api.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.@Deprecated public static Server forRouter(Router router, Mode mode)
forRouter(Mode, Function)
The server will be running on a randomly selected ephemeral port, which can be checked using the httpPort property.
router
- The router for the server to serve.mode
- The mode the server will run on.public static Server forRouter(Mode mode, java.util.function.Function<play.api.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.@Deprecated public static Server forRouter(Router router, int port)
forRouter(int, Function)
The server will be running in TEST mode.
router
- The router for the server to serve.port
- The port the server will run on.public static Server forRouter(int port, java.util.function.Function<play.api.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.@Deprecated public static Server forRouter(Router router, Mode mode, int port)
forRouter(Mode, int, Function)
router
- The router for the server to serve.mode
- The mode the server will run on.port
- The port the server will run on.public static Server forRouter(Mode mode, int port, java.util.function.Function<play.api.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.