Package org.glassfish.tyrus.server
Class Server
- java.lang.Object
-
- org.glassfish.tyrus.server.Server
-
public class Server extends java.lang.Object
Implementation of the WebSocket Server.- Author:
- Stepan Kopriva, Pavel Bucek
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
STATIC_CONTENT_ROOT
Path to static content to be served by created Server instance.
-
Constructor Summary
Constructors Constructor Description Server(java.lang.Class<?>... configuration)
Create new server instance.Server(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.Class<?>... configuration)
Construct new server.Server(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Set<java.lang.Class<?>> configuration)
Construct new server.Server(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.Class<?>... configuration)
Create new server instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPort()
Get the port which was used to start the container.static void
main(java.lang.String[] args)
void
start()
Start the server.void
stop()
Stop the server.
-
-
-
Constructor Detail
-
Server
public Server(java.lang.Class<?>... configuration)
Create new server instance.- Parameters:
configuration
- to be registered with the server. Classes annotated withServerEndpoint
, implementingServerApplicationConfig
or extendingServerEndpointConfig
are supported.
-
Server
public Server(java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.Class<?>... configuration)
Create new server instance.- Parameters:
properties
- properties used as a parameter to(java.util.Map)
call.configuration
- to be registered with the server. Classes annotated withServerEndpoint
, implementingServerApplicationConfig
or extendingServerEndpointConfig
are supported.
-
Server
public Server(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,java.lang.Object> properties, java.lang.Class<?>... configuration)
Construct new server.- Parameters:
hostName
- hostName of the server.port
- port of the server. When provided value is0
, default port (8025) 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 withServerEndpoint
, implementingServerApplicationConfig
or extendingServerEndpointConfig
are supported.- See Also:
getPort()
-
Server
public Server(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,java.lang.Object> properties, java.util.Set<java.lang.Class<?>> configuration)
Construct new server.- Parameters:
hostName
- hostName of the server.port
- port of the server. When provided value is0
, default port (8025) 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 withServerEndpoint
, implementingServerApplicationConfig
or extendingServerEndpointConfig
are supported.- See Also:
getPort()
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
start
public void start() throws DeploymentException
Start the server.- Throws:
DeploymentException
-
getPort
public int getPort()
Get the port which was used to start the container.- Returns:
- the port which was used to start the container.
-
stop
public void stop()
Stop the server.
-
-