|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.websockets.WebSocketAdapter
org.glassfish.grizzly.websockets.WebSocketApplication
public abstract class WebSocketApplication
Abstract server-side WebSocket application, which will handle
application WebSockets events.
| Constructor Summary | |
|---|---|
WebSocketApplication()
|
|
| Method Summary | |
|---|---|
protected boolean |
add(WebSocket socket)
Associates the specified WebSocket with this application. |
WebSocket |
createSocket(ProtocolHandler handler,
HttpRequestPacket requestPacket,
WebSocketListener... listeners)
Factory method to create new WebSocket instances. |
WebSocket |
createSocket(ProtocolHandler handler,
WebSocketListener... listeners)
Deprecated. Use createSocket(ProtocolHandler, org.glassfish.grizzly.http.HttpRequestPacket, WebSocketListener...) |
List<String> |
getSupportedExtensions()
Return the websocket extensions supported by this WebSocketApplication. |
List<String> |
getSupportedProtocols(List<String> subProtocol)
|
protected Set<WebSocket> |
getWebSockets()
Returns a set of WebSockets, registered with the application. |
protected void |
handshake(HandShake handshake)
This method will be called, when initial WebSocket handshake
process has been completed, but allows the application to perform further
negotiation/validation. |
abstract boolean |
isApplicationRequest(HttpRequestPacket request)
Checks application specific criteria to determine if this application can process the request as a WebSocket connection. |
void |
onClose(WebSocket socket,
DataFrame frame)
When a WebSocket.onClose(DataFrame) is invoked, the WebSocket
will be unassociated with this application and closed. |
void |
onConnect(WebSocket socket)
When a new WebSocket connection is made to this application, the
WebSocket will be associated with this application. |
boolean |
remove(WebSocket socket)
Unassociates the specified WebSocket with this application. |
boolean |
upgrade(HttpRequestPacket request)
Checks protocol specific information can and should be upgraded. |
| Methods inherited from class org.glassfish.grizzly.websockets.WebSocketAdapter |
|---|
onFragment, onFragment, onMessage, onMessage, onPing, onPong |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WebSocketApplication()
| Method Detail |
|---|
@Deprecated
public WebSocket createSocket(ProtocolHandler handler,
WebSocketListener... listeners)
createSocket(ProtocolHandler, org.glassfish.grizzly.http.HttpRequestPacket, WebSocketListener...)
WebSocket instances. Developers may
wish to override this to return customized WebSocket implementations.
handler - the ProtocolHandler to use with the newly created
WebSocket.listeners - the WebSocketListeners to associate with the new
WebSocket.
WebSocket instance.
public WebSocket createSocket(ProtocolHandler handler,
HttpRequestPacket requestPacket,
WebSocketListener... listeners)
WebSocket instances. Developers may
wish to override this to return customized WebSocket implementations.
handler - the ProtocolHandler to use with the newly created
WebSocket.requestPacket - the HttpRequestPacket that triggered the
creation of the WebSocket connection.listeners - the WebSocketListeners to associate with the new
WebSocket.
public void onClose(WebSocket socket,
DataFrame frame)
WebSocket.onClose(DataFrame) is invoked, the WebSocket
will be unassociated with this application and closed.
onClose in interface WebSocketListeneronClose in class WebSocketAdaptersocket - the WebSocket being closed.frame - the closing frame.public void onConnect(WebSocket socket)
WebSocket connection is made to this application, the
WebSocket will be associated with this application.
onConnect in interface WebSocketListeneronConnect in class WebSocketAdaptersocket - the new WebSocket connection.public final boolean upgrade(HttpRequestPacket request)
Upgrade header with a value of WebSocket.
If present, isApplicationRequest(org.glassfish.grizzly.http.HttpRequestPacket)
will be invoked to determine if the request is a valid websocket request.
true if the request should be upgraded to a
WebSocket connectionpublic abstract boolean isApplicationRequest(HttpRequestPacket request)
request - the incoming HTTP request.
true if this application can service this requestpublic List<String> getSupportedExtensions()
WebSocketApplication.
WebSocketApplication.public List<String> getSupportedProtocols(List<String> subProtocol)
subProtocol -
protected Set<WebSocket> getWebSockets()
WebSockets, registered with the application.
The returned set is unmodifiable, the possible modifications may cause exceptions.
WebSockets, registered with the application.protected boolean add(WebSocket socket)
WebSocket with this application.
socket - the WebSocket to associate with this application.
true if the socket was successfully associated,
otherwise returns false.public boolean remove(WebSocket socket)
WebSocket with this application.
socket - the WebSocket to unassociate with this application.
true if the socket was successfully unassociated,
otherwise returns false.
protected void handshake(HandShake handshake)
throws HandshakeException
WebSocket handshake
process has been completed, but allows the application to perform further
negotiation/validation.
HandshakeException - error occurred during the handshake.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||