Package org.atmosphere.websocket
Class WebSocketProcessorAdapter
- java.lang.Object
-
- org.atmosphere.websocket.WebSocketProcessorAdapter
-
- All Implemented Interfaces:
WebSocketProcessor
public class WebSocketProcessorAdapter extends java.lang.Object implements WebSocketProcessor
Simple Adapter fprWebSocketProcessor- Author:
- Jeanfrancois Arcand
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.atmosphere.websocket.WebSocketProcessor
WebSocketProcessor.WebSocketException, WebSocketProcessor.WebSocketHandlerProxy
-
-
Constructor Summary
Constructors Constructor Description WebSocketProcessorAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(WebSocket webSocket, int closeCode)Invked when the WebServer is closing the native WebSocketWebSocketProcessorconfigure(AtmosphereConfig config)Configure, or post construct a WebSocketProcessorvoiddestroy()Destroy all resources associated with this class.booleanhandshake(javax.servlet.http.HttpServletRequest request)Determine if the WebSocket's handshake data can be processed, or if the request be cancelled.voidinvokeWebSocketProtocol(WebSocket webSocket, byte[] data, int offset, int length)Invoked when a WebSocket message gets received from the underlying containervoidinvokeWebSocketProtocol(WebSocket webSocket, java.io.InputStream stream)Invoked when a WebSocket message gets received from the underlying containervoidinvokeWebSocketProtocol(WebSocket webSocket, java.io.Reader reader)Invoked when a WebSocket message gets received from the underlying containervoidinvokeWebSocketProtocol(WebSocket webSocket, java.lang.String webSocketMessage)Invoked when a WebSocket message gets received from the underlying containervoidnotifyListener(WebSocket webSocket, WebSocketEventListener.WebSocketEvent webSocketEvent)Notify allWebSocketEventListenervoidopen(WebSocket webSocket, AtmosphereRequest request, AtmosphereResponse response)Invoked when a WebSocket gets opened by the underlying containerWebSocketProcessorregisterWebSocketHandler(java.lang.String path, WebSocketProcessor.WebSocketHandlerProxy webSockethandler)Register aWebSocketHandler
-
-
-
Method Detail
-
configure
public WebSocketProcessor configure(AtmosphereConfig config)
Description copied from interface:WebSocketProcessorConfigure, or post construct a WebSocketProcessor- Specified by:
configurein interfaceWebSocketProcessor- Parameters:
config- anAtmosphereConfig- Returns:
- this
-
handshake
public boolean handshake(javax.servlet.http.HttpServletRequest request)
Description copied from interface:WebSocketProcessorDetermine if the WebSocket's handshake data can be processed, or if the request be cancelled. Since it's container related native API, theHttpServletRequestmight be null, so implementation must check for null.- Specified by:
handshakein interfaceWebSocketProcessor- Parameters:
request-HttpServletRequest- Returns:
- true if the processing can continue, false if not.
-
registerWebSocketHandler
public WebSocketProcessor registerWebSocketHandler(java.lang.String path, WebSocketProcessor.WebSocketHandlerProxy webSockethandler)
Description copied from interface:WebSocketProcessorRegister aWebSocketHandler- Specified by:
registerWebSocketHandlerin interfaceWebSocketProcessor- Parameters:
path- the URI mapping the WebSocketHandlerwebSockethandler- an instance ofWebSocketProcessor.WebSocketHandlerProxy- Returns:
- this
-
open
public void open(WebSocket webSocket, AtmosphereRequest request, AtmosphereResponse response) throws java.io.IOException
Description copied from interface:WebSocketProcessorInvoked when a WebSocket gets opened by the underlying container- Specified by:
openin interfaceWebSocketProcessor- Throws:
java.io.IOException
-
invokeWebSocketProtocol
public void invokeWebSocketProtocol(WebSocket webSocket, java.lang.String webSocketMessage)
Description copied from interface:WebSocketProcessorInvoked when a WebSocket message gets received from the underlying container- Specified by:
invokeWebSocketProtocolin interfaceWebSocketProcessor
-
invokeWebSocketProtocol
public void invokeWebSocketProtocol(WebSocket webSocket, java.io.InputStream stream)
Description copied from interface:WebSocketProcessorInvoked when a WebSocket message gets received from the underlying container- Specified by:
invokeWebSocketProtocolin interfaceWebSocketProcessor
-
invokeWebSocketProtocol
public void invokeWebSocketProtocol(WebSocket webSocket, java.io.Reader reader)
Description copied from interface:WebSocketProcessorInvoked when a WebSocket message gets received from the underlying container- Specified by:
invokeWebSocketProtocolin interfaceWebSocketProcessor
-
invokeWebSocketProtocol
public void invokeWebSocketProtocol(WebSocket webSocket, byte[] data, int offset, int length)
Description copied from interface:WebSocketProcessorInvoked when a WebSocket message gets received from the underlying container- Specified by:
invokeWebSocketProtocolin interfaceWebSocketProcessor
-
close
public void close(WebSocket webSocket, int closeCode)
Description copied from interface:WebSocketProcessorInvked when the WebServer is closing the native WebSocket- Specified by:
closein interfaceWebSocketProcessor
-
notifyListener
public void notifyListener(WebSocket webSocket, WebSocketEventListener.WebSocketEvent webSocketEvent)
Description copied from interface:WebSocketProcessorNotify allWebSocketEventListener- Specified by:
notifyListenerin interfaceWebSocketProcessor
-
destroy
public void destroy()
Description copied from interface:WebSocketProcessorDestroy all resources associated with this class.- Specified by:
destroyin interfaceWebSocketProcessor
-
-