private static void checkBlockPadding(HttpAcceptSession session) { // TODO: Verify if counting bytes is really necessary // check to see if we need to add a padding message to the end of sent messages long writtenBytes = session.getWrittenBytes(); Long bytesWrittenOnLastFlush = ((Long)session.getAttribute(SseAcceptor.BYTES_WRITTEN_ON_LAST_FLUSH_KEY)); if (bytesWrittenOnLastFlush == null || writtenBytes != bytesWrittenOnLastFlush) { // Block Padding is required session.write(SseEncoder.BLOCK_PADDING_MESSAGE); session.setAttribute(SseAcceptor.BYTES_WRITTEN_ON_LAST_FLUSH_KEY, writtenBytes + 4096); } }
private static void checkBlockPadding(HttpAcceptSession session) { // TODO: Verify if counting bytes is really necessary // check to see if we need to add a padding message to the end of sent messages long writtenBytes = session.getWrittenBytes(); Long bytesWrittenOnLastFlush = (Long)session.getAttribute(WsebAcceptor.BYTES_WRITTEN_ON_LAST_FLUSH_KEY); if (bytesWrittenOnLastFlush == null || writtenBytes != bytesWrittenOnLastFlush) { // Block Padding is required session.write(WsebFrameEncoder.BLOCK_PADDING_MESSAGE); session.setAttribute(WsebAcceptor.BYTES_WRITTEN_ON_LAST_FLUSH_KEY, writtenBytes + 4096); } }
session.setAttribute(WsebAcceptor.CLIENT_BUFFER_KEY, 0L); session.setAttribute(WsebAcceptor.CLIENT_BUFFER_KEY, bufferSize); session.setAttribute(WsebAcceptor.CLIENT_PADDING_KEY, paddingSize); session.setAttribute(WsebAcceptor.BYTES_WRITTEN_ON_LAST_FLUSH_KEY, (long) 0); if (clientBlockPadding != null) { int paddingSize = Integer.parseInt(clientBlockPadding); session.setAttribute(WsebAcceptor.CLIENT_BLOCK_PADDING_KEY, paddingSize); session.setWriteHeader("Content-Encoding", "gzip");
session.getReadHeader(HEADER_WEBSOCKET_KEY1) != null) { session.setAttribute(WSN_HTTP_BRIDGE_HANDLER, wsnHttpDraft76BridgeHandler); wsnHttpDraft76BridgeHandler.sessionOpened(session); session.setAttribute(WSN_HTTP_BRIDGE_HANDLER, wsnHttpDraft75BridgeHandler); wsnHttpDraft75BridgeHandler.sessionOpened(session); } else {
httpSession.setAttribute(CLIENT_BUFFER_KEY, bufferSize); httpSession.setAttribute(CLIENT_BUFFER_KEY, 0L); if (clientPadding != null) { int paddingSize = Integer.parseInt(clientPadding); httpSession.setAttribute(CLIENT_PADDING_KEY, paddingSize); httpSession.setAttribute(BYTES_WRITTEN_ON_LAST_FLUSH_KEY, (long) 0); if (clientBlockPadding != null) { int paddingSize = Integer.parseInt(clientBlockPadding); httpSession.setAttribute(CLIENT_BLOCK_PADDING_KEY, paddingSize); httpSession.setWriteHeader("Content-Encoding", "gzip");