Package org.glassfish.tyrus.server
Class Server
- java.lang.Object
-
- org.glassfish.tyrus.server.Server
-
public class Server extends java.lang.ObjectImplementation of the WebSocket Server.- Author:
- Stepan Kopriva, Pavel Bucek
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringSTATIC_CONTENT_ROOTPath 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 intgetPort()Get the port which was used to start the container.static voidmain(java.lang.String[] args)voidstart()Start the server.voidstop()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, implementingServerApplicationConfigor extendingServerEndpointConfigare 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, implementingServerApplicationConfigor extendingServerEndpointConfigare 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, implementingServerApplicationConfigor extendingServerEndpointConfigare 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, implementingServerApplicationConfigor extendingServerEndpointConfigare supported.- See Also:
getPort()
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
start
public void start() throws jakarta.websocket.DeploymentExceptionStart the server.- Throws:
jakarta.websocket.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.
-
-