public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static WebSocket getWebSocket(Connection connection) { final WebSocketHolder holder = get(connection); return holder == null ? null : holder.webSocket; }
public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
public static boolean isWebSocketInProgress(final Connection connection) { return (get(connection) != null); }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
private static NextAction handleClientHandShake(FilterChainContext ctx, HttpContent content) { final WebSocketHolder holder = WebSocketHolder.get(ctx.getConnection()); holder.handshake.validateServerResponse((HttpResponsePacket) content.getHttpHeader()); holder.webSocket.onConnect(); if (content.getContent().hasRemaining()) { return ctx.getRerunFilterAction(); } else { content.recycle(); return ctx.getStopAction(); } } }
/** * 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(); }