public class WebSocketEngine extends Object
WebSocketApplications registration, responsible
for client and server handshake validation.WebSocket,
WebSocketApplication| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_TIMEOUT |
static Version |
DEFAULT_VERSION |
| Modifier and Type | Method and Description |
|---|---|
WebSocketApplication |
getApplication(org.glassfish.grizzly.http.HttpRequestPacket request) |
static WebSocketEngine |
getEngine() |
static ProtocolHandler |
loadHandler(org.glassfish.grizzly.http.util.MimeHeaders headers) |
void |
register(String contextPath,
String urlPattern,
WebSocketApplication app)
Register a WebSocketApplication to a specific context path and url pattern.
|
void |
register(WebSocketApplication app)
Deprecated.
|
void |
unregister(WebSocketApplication app) |
void |
unregisterAll()
Un-registers all
WebSocketApplication instances with the
WebSocketEngine. |
boolean |
upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.http.HttpContent requestContent) |
boolean |
upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.http.HttpContent requestContent,
org.glassfish.grizzly.http.server.util.Mapper mapper) |
public static final Version DEFAULT_VERSION
public static final int DEFAULT_TIMEOUT
public static WebSocketEngine getEngine()
public WebSocketApplication getApplication(org.glassfish.grizzly.http.HttpRequestPacket request)
public boolean upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.http.HttpContent requestContent)
throws IOException
IOExceptionpublic boolean upgrade(org.glassfish.grizzly.filterchain.FilterChainContext ctx,
org.glassfish.grizzly.http.HttpContent requestContent,
org.glassfish.grizzly.http.server.util.Mapper mapper)
throws IOException
IOExceptionpublic static ProtocolHandler loadHandler(org.glassfish.grizzly.http.util.MimeHeaders headers)
public void register(String contextPath, String urlPattern, WebSocketApplication app)
Examples:
// WS application will be invoked:
// ws://localhost:8080/echo
// WS application will not be invoked:
// ws://localhost:8080/foo/echo
// ws://localhost:8080/echo/some/path
register("", "/echo", webSocketApplication);
// WS application will be invoked:
// ws://localhost:8080/echo
// ws://localhost:8080/echo/some/path
// WS application will not be invoked:
// ws://localhost:8080/foo/echo
register("", "/echo/*", webSocketApplication);
// WS application will be invoked:
// ws://localhost:8080/context/echo
// WS application will not be invoked:
// ws://localhost:8080/echo
// ws://localhost:8080/context/some/path
register("/context", "/echo", webSocketApplication);
contextPath - the context path (per servlet rules)urlPattern - url pattern (per servlet rules)app - the WebSocket application.@Deprecated public void register(WebSocketApplication app)
register(String, String, WebSocketApplication)public void unregister(WebSocketApplication app)
public void unregisterAll()
WebSocketApplication instances with the
WebSocketEngine.Copyright © 2022 Oracle Corporation. All Rights Reserved.