io.undertow.websockets.core.BufferedBinaryMessage Java Examples
The following examples show how to use
io.undertow.websockets.core.BufferedBinaryMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketTtyConnection.java From termd with Apache License 2.0 | 6 votes |
private void registerWebSocketChannelListener(WebSocketChannel webSocketChannel) { ChannelListener<WebSocketChannel> listener = new AbstractReceiveListener() { @Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException { log.trace("Server received full binary message"); Pooled<ByteBuffer[]> pulledData = message.getData(); try { ByteBuffer[] resource = pulledData.getResource(); ByteBuffer byteBuffer = WebSockets.mergeBuffers(resource); String msg = new String(byteBuffer.array()); log.trace("Sending message to decoder: {}", msg); writeToDecoder(msg); } finally { pulledData.discard(); } } }; webSocketChannel.getReceiveSetter().set(listener); }
Example #2
Source File: WebSocketTtyConnection.java From aesh-readline with Apache License 2.0 | 6 votes |
private void registerWebSocketChannelListener(WebSocketChannel webSocketChannel) { ChannelListener<WebSocketChannel> listener = new AbstractReceiveListener() { @Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException { log.log(Level.FINE, "Server received full binary message"); Pooled<ByteBuffer[]> pulledData = message.getData(); try { ByteBuffer[] resource = pulledData.getResource(); ByteBuffer byteBuffer = WebSockets.mergeBuffers(resource); String msg = new String(byteBuffer.array()); log.log(Level.FINE, "Sending message to decoder: "+ msg); writeToDecoder(msg); } finally { pulledData.discard(); } } }; webSocketChannel.getReceiveSetter().set(listener); }
Example #3
Source File: WebSocketTtyConnection.java From termd with Apache License 2.0 | 6 votes |
private void registerWebSocketChannelListener(WebSocketChannel webSocketChannel) { ChannelListener<WebSocketChannel> listener = new AbstractReceiveListener() { @Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException { log.trace("Server received full binary message"); Pooled<ByteBuffer[]> pulledData = message.getData(); try { ByteBuffer[] resource = pulledData.getResource(); ByteBuffer byteBuffer = WebSockets.mergeBuffers(resource); String msg = new String(byteBuffer.array()); log.trace("Sending message to decoder: {}", msg); writeToDecoder(msg); } finally { pulledData.discard(); } } }; webSocketChannel.getReceiveSetter().set(listener); }
Example #4
Source File: WebSocketUndertowServletRequest.java From cxf with Apache License 2.0 | 6 votes |
public WebSocketUndertowServletRequest(WebSocketChannel channel, Object message, HttpServerExchange exchange) throws IOException { this.channel = channel; if (message instanceof BufferedBinaryMessage) { in = new ByteBufferInputStream(((BufferedBinaryMessage)message).getData().getResource()[0]); } else if (message instanceof BufferedTextMessage) { in = new ByteArrayInputStream(((BufferedTextMessage)message).getData().getBytes()); } this.requestHeaders = WebSocketUtils.readHeaders(in); /*String path = requestHeaders.get(WebSocketUtils.URI_KEY); String origin = channel.getUrl(); path = path.substring(0, path.length() - 10); if (!path.startsWith(origin)) { throw new InvalidPathException(); }*/ this.attributes = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); Object v = channel.getAttribute("org.apache.cxf.transport.endpoint.address"); if (v != null) { attributes.put("org.apache.cxf.transport.endpoint.address", v); } }
Example #5
Source File: UndertowWebSocketAdapter.java From pippo with Apache License 2.0 | 5 votes |
@Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) throws IOException { Pooled<ByteBuffer[]> pulledData = message.getData(); try { ByteBuffer[] resource = pulledData.getResource(); ByteBuffer buffer = WebSockets.mergeBuffers(resource); handler.onMessage(context, buffer.array()); } finally { pulledData.discard(); } }
Example #6
Source File: UndertowWebSocketHandlerAdapter.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) { this.session.handleMessage(Type.BINARY, toMessage(Type.BINARY, message.getData().getResource())); message.getData().free(); }
Example #7
Source File: UndertowWebSocketHandlerAdapter.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) { this.session.handleMessage(Type.PONG, toMessage(Type.PONG, message.getData().getResource())); message.getData().free(); }
Example #8
Source File: UndertowWebSocketHandlerAdapter.java From spring-analysis-note with MIT License | 4 votes |
@Override protected void onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) { CloseMessage closeMessage = new CloseMessage(message.getData().getResource()); this.session.handleClose(new CloseStatus(closeMessage.getCode(), closeMessage.getReason())); message.getData().free(); }
Example #9
Source File: UndertowWebSocketHandlerAdapter.java From java-technology-stack with MIT License | 4 votes |
@Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) { this.session.handleMessage(Type.BINARY, toMessage(Type.BINARY, message.getData().getResource())); message.getData().free(); }
Example #10
Source File: UndertowWebSocketHandlerAdapter.java From java-technology-stack with MIT License | 4 votes |
@Override protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) { this.session.handleMessage(Type.PONG, toMessage(Type.PONG, message.getData().getResource())); message.getData().free(); }
Example #11
Source File: UndertowWebSocketHandlerAdapter.java From java-technology-stack with MIT License | 4 votes |
@Override protected void onFullCloseMessage(WebSocketChannel channel, BufferedBinaryMessage message) { CloseMessage closeMessage = new CloseMessage(message.getData().getResource()); this.session.handleClose(new CloseStatus(closeMessage.getCode(), closeMessage.getReason())); message.getData().free(); }
Example #12
Source File: MangooWebSocket.java From mangooio with Apache License 2.0 | 4 votes |
@Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) {}
Example #13
Source File: MangooWebSocket.java From mangooio with Apache License 2.0 | 4 votes |
@Override protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) {}
Example #14
Source File: WebSocketController.java From mangooio with Apache License 2.0 | 4 votes |
@Override protected void onFullBinaryMessage(WebSocketChannel channel, BufferedBinaryMessage message) { LOG.info(message.toString()); }
Example #15
Source File: WebSocketController.java From mangooio with Apache License 2.0 | 4 votes |
@Override protected void onFullPongMessage(WebSocketChannel channel, BufferedBinaryMessage message) { LOG.info(message.toString()); }