Class SimpleHttpProtocol
java.lang.Object
org.atmosphere.websocket.protocol.SimpleHttpProtocol
- All Implemented Interfaces:
Serializable,AtmosphereConfigAware,WebSocketProtocol
Like the
AsynchronousProcessor class, this class is responsible for dispatching WebSocket messages to the
proper WebSocket implementation by wrapping the Websocket message's bytes within
an HttpServletRequest.
The content-type is defined using ApplicationConfig.WEBSOCKET_CONTENT_TYPE property
The method is defined using ApplicationConfig.WEBSOCKET_METHOD property
- Author:
- Jeanfrancois Arcand
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.voidInvoked when a WebSocket is closedvoidonError(WebSocket webSocket, WebSocketProcessor.WebSocketException t) Invoked when an error occurs.Parse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.Parse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.voidInvoked when a WebSocket is opened
-
Field Details
-
TEXT
- See Also:
-
contentType
-
methodType
-
delimiter
-
destroyable
protected boolean destroyable -
rewriteUri
protected boolean rewriteUri
-
-
Constructor Details
-
SimpleHttpProtocol
public SimpleHttpProtocol()
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
onMessage
Description copied from interface:WebSocketProtocolParse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology. InvokingAtmosphereFramework.asyncSupportwill delegate the request processing to theAtmosphereHandlerimplementation. Returning null means this implementation will handle itself the processing/dispatching of the WebSocket's request;
As an example, this is how Websocket messages are delegated to the Jersey runtime.- Specified by:
onMessagein interfaceWebSocketProtocol- Parameters:
webSocket- TheWebSocketconnectionmessage- The Websocket message- Returns:
- a List of
AtmosphereRequest
-
onMessage
Description copied from interface:WebSocketProtocolParse the WebSocket message, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology. InvokingAtmosphereFramework.asyncSupportwill delegate the request processing to theAtmosphereHandlerimplementation. Returning null means this implementation will handle itself the processing/dispatching of the WebSocket's request;
As an example, this is how Websocket messages are delegated to the Jersey runtime.- Specified by:
onMessagein interfaceWebSocketProtocol- Parameters:
webSocket- TheWebSocketconnectionoffset- offset message indexlength- length of the message.- Returns:
- a List of
AtmosphereRequest
-
onOpen
Description copied from interface:WebSocketProtocolInvoked when a WebSocket is opened- Specified by:
onOpenin interfaceWebSocketProtocol- Parameters:
webSocket-WebSocket
-
onClose
Description copied from interface:WebSocketProtocolInvoked when a WebSocket is closed- Specified by:
onClosein interfaceWebSocketProtocol- Parameters:
webSocket-WebSocket
-
onError
Description copied from interface:WebSocketProtocolInvoked when an error occurs.- Specified by:
onErrorin interfaceWebSocketProtocol- Parameters:
webSocket-WebSockett- aWebSocketProcessor.WebSocketException
-