public class WebSocketEngine extends Object
WebSocketApplication
s 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(HttpRequestPacket request) |
static WebSocketEngine |
getEngine() |
static ProtocolHandler |
loadHandler(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(FilterChainContext ctx,
HttpContent requestContent) |
boolean |
upgrade(FilterChainContext ctx,
HttpContent requestContent,
Mapper mapper) |
public static final Version DEFAULT_VERSION
public static final int DEFAULT_TIMEOUT
public static WebSocketEngine getEngine()
public WebSocketApplication getApplication(HttpRequestPacket request)
public boolean upgrade(FilterChainContext ctx, HttpContent requestContent) throws IOException
IOException
public boolean upgrade(FilterChainContext ctx, HttpContent requestContent, Mapper mapper) throws IOException
IOException
public static ProtocolHandler loadHandler(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 © 2015 Oracle Corporation. All rights reserved.