/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }
/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }
/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }
/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }
/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }
/** * Handle Grizzly {@link Connection} write phase. If the {@link Connection} has associated {@link WebSocket} object * (websocket connection), we assume that message is websocket {@link DataFrame} and serialize it into a {@link * Buffer}. * * @param ctx {@link FilterChainContext} * * @return {@link NextAction} instruction for {@link FilterChain}, how it should continue the execution * * @throws java.io.IOException */ @Override public NextAction handleWrite(FilterChainContext ctx) throws IOException { // get the associated websocket final WebSocket websocket = getWebSocket(ctx.getConnection()); final Object msg = ctx.getMessage(); // if there is one if (websocket != null && DataFrame.isDataFrame(msg)) { final DataFrame frame = (DataFrame) msg; final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); final Buffer wrap = Buffers.wrap(ctx.getMemoryManager(), holder.handler.frame(frame)); ctx.setMessage(wrap); } // invoke next filter in the chain return ctx.getInvokeAction(); }