public class Server extends Object
Modifier and Type | Field and Description |
---|---|
static String |
STATIC_CONTENT_ROOT
Path to static content to be served by created Server instance.
|
Constructor and Description |
---|
Server(Class<?>... configuration)
Create new server instance.
|
Server(Map<String,Object> properties,
Class<?>... configuration)
Create new server instance.
|
Server(String hostName,
int port,
String contextPath,
Map<String,Object> properties,
Class<?>... configuration)
Construct new server.
|
Server(String hostName,
int port,
String contextPath,
Map<String,Object> properties,
Set<Class<?>> configuration)
Construct new server.
|
Modifier and Type | Method and Description |
---|---|
int |
getPort()
Get the port which was used to start the container.
|
static void |
main(String[] args) |
void |
start()
Start the server.
|
void |
stop()
Stop the server.
|
public Server(Class<?>... configuration)
configuration
- to be registered with the server. Classes annotated with ServerEndpoint
, implementing
ServerApplicationConfig
or extending ServerEndpointConfig
are supported.public Server(Map<String,Object> properties, Class<?>... configuration)
properties
- properties used as a parameter to (java.util.Map)
call.configuration
- to be registered with the server. Classes annotated with ServerEndpoint
, implementing ServerApplicationConfig
or extending ServerEndpointConfig
are supported.public Server(String hostName, int port, String contextPath, Map<String,Object> properties, Class<?>... configuration)
hostName
- hostName of the server.port
- port of the server. When provided value is 0
, default port ()
will be used, when -1
, ephemeral port number will be used.contextPath
- root path to the server App.properties
- properties used as a parameter to (java.util.Map)
call.configuration
- to be registered with the server. Classes annotated with ServerEndpoint
, implementing
ServerApplicationConfig
or extending ServerEndpointConfig
are supported.getPort()
public Server(String hostName, int port, String contextPath, Map<String,Object> properties, Set<Class<?>> configuration)
hostName
- hostName of the server.port
- port of the server. When provided value is 0
, default port ()
will be used, when -1
, ephemeral port number will be used.contextPath
- root path to the server App.properties
- properties used as a parameter to (java.util.Map)
call.configuration
- to be registered with the server. Classes annotated with ServerEndpoint
, implementing ServerApplicationConfig
or extending ServerEndpointConfig
are supported.getPort()
public static void main(String[] args)
public void start() throws DeploymentException
DeploymentException
public int getPort()
public void stop()
Copyright © 2012–2019 Oracle Corporation. All rights reserved.