Class StreamingHttpProtocol
java.lang.Object
org.atmosphere.websocket.protocol.StreamingHttpProtocol
- All Implemented Interfaces:
AtmosphereConfigAware,WebSocketProtocol,WebSocketProtocolStream
Like the
AsynchronousProcessor class, this class is responsible for dispatching WebSocket stream 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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(AtmosphereConfig config) Configure an AtmosphereFramework object.onBinaryStream(WebSocket webSocket, InputStream stream) Parse the WebSocket stream, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.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 openedonTextStream(WebSocket webSocket, Reader r) Parse the WebSocket stream, and delegate the processing to theAtmosphereFramework.asyncSupportor to any existing technology.
-
Field Details
-
TEXT
- See Also:
-
contentType
-
methodType
-
delimiter
-
destroyable
protected boolean destroyable
-
-
Constructor Details
-
StreamingHttpProtocol
public StreamingHttpProtocol()
-
-
Method Details
-
configure
Description copied from interface:AtmosphereConfigAwareConfigure an AtmosphereFramework object.- Specified by:
configurein interfaceAtmosphereConfigAware- Parameters:
config-AtmosphereConfig
-
onTextStream
Description copied from interface:WebSocketProtocolStreamParse the WebSocket stream, 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:
onTextStreamin interfaceWebSocketProtocolStream- Parameters:
webSocket- TheWebSocketconnectionr- aReader- Returns:
- a List of
AtmosphereRequest
-
onBinaryStream
Description copied from interface:WebSocketProtocolStreamParse the WebSocket stream, 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:
onBinaryStreamin interfaceWebSocketProtocolStream- Parameters:
webSocket- TheWebSocketconnectionstream- aReader- 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- TheWebSocketconnectiondata- 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
-