public class WebApi extends Object
Constructor and Description |
---|
WebApi(ServerConfiguration serverConfig)
Creates a
WebApi instance. |
Modifier and Type | Method and Description |
---|---|
void |
addHttpEndpoint(HttpMethod httpMethod,
String path,
HttpHandler handler)
Adds an HTTP endpoint to the web API.
|
void |
addWebSocketEndpoint(String path,
WebSocketHandler handler)
Adds a WebSocket endpoint to the web API.
|
protected org.eclipse.jetty.servlet.ServletContextHandler |
getContextHandler()
Returns the servlet context.
|
Set<org.eclipse.jetty.websocket.api.Session> |
getOpenWebSocketSessions(Class<? extends WebSocketHandler> socketHandlerClass)
Returns a set of open WebSocket sessions that represent connections to the specific
endpoint.
|
protected org.eclipse.jetty.server.Server |
getServer()
Returns the Jetty HTTP servlet server.
|
ServerConfiguration |
getServerConfiguration()
Returns the configuration of the web server.
|
void |
start()
Starts the web server.
|
void |
stop()
Stops the web server.
|
public WebApi(ServerConfiguration serverConfig)
WebApi
instance.serverConfig
- the configuration of the web serverpublic ServerConfiguration getServerConfiguration()
public void start()
public void stop()
public Set<org.eclipse.jetty.websocket.api.Session> getOpenWebSocketSessions(Class<? extends WebSocketHandler> socketHandlerClass)
socketHandlerClass
- the runtime class of the WebSocket endpoint handlerpublic void addHttpEndpoint(HttpMethod httpMethod, String path, HttpHandler handler)
httpMethod
- the HTTP method of the endpointpath
- the path of the endpointhandler
- the handler of the endpointpublic void addWebSocketEndpoint(String path, WebSocketHandler handler)
path
- the path of the endpointhandler
- the handler of the endpointprotected org.eclipse.jetty.server.Server getServer()
protected org.eclipse.jetty.servlet.ServletContextHandler getContextHandler()
Copyright © 2020. All rights reserved.