@Override protected void doMessageReceived(IoSessionEx session, Object message) throws Exception { IoSession tcpBridgeSession = getTcpBridgeSession(session); tcpBridgeSession.getFilterChain().fireMessageReceived(message); } }
@Override public void messageReceived(IoSession session, Object message) throws Exception { IoSession proxySession = getProxySession(session); proxySession.getFilterChain().fireMessageReceived(message); }
@Override protected void doMessageReceived(IoSessionEx session, Object message) throws Exception { IoSession tcpBridgeSession = getTcpBridgeSession(session); tcpBridgeSession.getFilterChain().fireMessageReceived(message); }
@Override protected void consume(DefaultHttpSession session) { if (session.isReadSuspended()) { return; } Queue<IoBufferEx> deferredReads = session.getDeferredReads(); IoBufferEx buffer; while ( (buffer = deferredReads.poll()) != null) { if (buffer.hasRemaining()) { // direct read for now, in the future this should always get buffered IoFilterChain filterChain = session.getFilterChain(); filterChain.fireMessageReceived(buffer); } } }
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { Object message = e.getMessage(); if (message instanceof ChannelBuffer) { ChannelBuffer buf = (ChannelBuffer) message; // note: read as unshared buffer // can convert via IoBufferEx.asSharedBuffer() if necessary later message = allocator.wrap(buf.toByteBuffer()); buf.skipBytes(buf.readableBytes()); } // filter chain can change if session is re-aligned IoFilterChain filterChain = session.getFilterChain(); filterChain.fireMessageReceived(message); }
private void fireContentReceived(HttpSession session, HttpContentMessage content) { IoBufferEx buffer = content.asBuffer(); if (buffer != null && buffer.hasRemaining()) { IoFilterChain filterChain = session.getFilterChain(); filterChain.fireMessageReceived(buffer); } // deliver the session close event when we receive the last chunk if (content.isComplete()) { session.close(false); } } };
@Override protected void doMessageReceived(final IoSessionEx session, Object message) throws Exception { if (message == SslFilter.SESSION_SECURED) { // no need for certificate selection filter after SSL handshake complete IoFilterChain filterChain = session.getFilterChain(); removeFilter(filterChain, certificateSelection); Callable<SslSession> sessionFactory = SSL_SESSION_FACTORY_KEY.get(session); SslSession sslSession = sessionFactory.call(); session.setAttribute(SSL_SESSION_KEY, sslSession); } else if (message == SslFilter.SESSION_UNSECURED) { SslSession sslSession = SSL_SESSION_KEY.get(session); sslSession.close(false); } else { SslSession sslSession = SSL_SESSION_KEY.get(session); IoFilterChain filterChain = sslSession.getFilterChain(); filterChain.fireMessageReceived(message); } }
private void fireContentReceived(DefaultHttpSession session, HttpContentMessage content) throws Exception { IoBufferEx buffer = content.asBuffer(); if (buffer != null && buffer.hasRemaining()) { // if suspended add this to session deferred read queue // KG-9201: if HTTP session is in the middle of thread re-alignment, // defer message received until re-alignment is complete if (!session.isIoRegistered() || session.isReadSuspended()) { session.addDeferredRead(buffer); } else { // direct read for now, in the future this should always get buffered IoFilterChain filterChain = session.getFilterChain(); filterChain.fireMessageReceived(buffer); } } } };
private void readHandle(DatagramChannel handle) throws Exception { IoBuffer readBuf = IoBuffer.allocate(getSessionConfig().getReadBufferSize()); SocketAddress remoteAddress = receive(handle, readBuf); if (remoteAddress != null) { IoSession session = newSessionWithoutLock(remoteAddress, localAddress(handle)); readBuf.flip(); if (!session.isReadSuspended()) { session.getFilterChain().fireMessageReceived(readBuf); } } }
@Override protected void doMessageReceived(HttpAcceptSession session, Object message) throws Exception { // this can happen if there is an error if (!(message instanceof WsMessage)) { return; } WsMessage wsebMessage = (WsMessage)message; IoFilterChain filterChain = wsebSession.getTransportSession().getFilterChain(); switch (wsebMessage.getKind()) { case COMMAND: for (Command command : ((WsCommandMessage)wsebMessage).getCommands()) { if (command == Command.close()) { session.setWriteHeader(HEADER_CONTENT_LENGTH, "0"); session.close(false); filterChain.fireMessageReceived(new WsCloseMessage()); break; } else if (command == Command.reconnect()) { session.setWriteHeader(HEADER_CONTENT_LENGTH, "0"); session.close(false); break; } // no-op (0x00) - continue reading commands } break; default: filterChain.fireMessageReceived(wsebMessage); break; } }
Object m = req.getMessage(); pushEvent(new IoEvent(IoEventType.MESSAGE_SENT, session, req), false); session.getRemoteSession().getFilterChain().fireMessageReceived(getMessageCopy(m)); if (m instanceof IoBuffer) { session.increaseWrittenBytes0(((IoBuffer) m).remaining(), currentTime);
Object m = req.getMessage(); pushEvent(new IoEvent(IoEventType.MESSAGE_SENT, session, req), false); session.getRemoteSession().getFilterChain().fireMessageReceived( getMessageCopy(m)); if (m instanceof IoBuffer) {
private void readHandle(DatagramChannel handle) throws Exception { IoBuffer readBuf = IoBuffer.allocate(getSessionConfig().getReadBufferSize()); SocketAddress remoteAddress = receive(handle, readBuf); if (remoteAddress != null) { IoSession session = newSessionWithoutLock(remoteAddress, localAddress(handle)); readBuf.flip(); if (!session.isReadSuspended()) { session.getFilterChain().fireMessageReceived(readBuf); } } }
filterChain.fireMessageReceived(new WsCloseMessage()); break; filterChain.fireMessageReceived(wsebMessage);
@Override protected void doMessageReceived(final HttpSession session, Object message) throws Exception { SseMessage sseMessage = (SseMessage) message; String type = sseMessage.getType(); IoBufferEx data = sseMessage.getData(); String id = sseMessage.getId(); boolean reconnect = sseMessage.isReconnect(); int retry = sseMessage.getRetry(); SseSession sseSession = SSE_SESSION_KEY.get(session); SseSessionConfig config = sseSession.getConfig(); config.setReconnecting(reconnect); if (retry >= 0) { config.setRetry(retry); } if (id != null) { config.setLastId(id); } if (data != null && data.hasRemaining() && (type == null || "message".equals(type))) { IoFilterChain filterChain = sseSession.getFilterChain(); filterChain.fireMessageReceived(data); } }
private void readHandle(H handle) throws Exception { IoBuffer readBuf = newReadBuffer(getSessionConfig().getReadBufferSize()); SocketAddress remoteAddress = receive(handle, readBuf); if (remoteAddress != null) { IoSession session = newSessionWithoutLock( remoteAddress, localAddress(handle)); readBuf.flip(); IoBuffer newBuf = newReadBuffer(readBuf.limit()); newBuf.put(readBuf); newBuf.flip(); session.getFilterChain().fireMessageReceived(newBuf); } }
@Override protected void doMessageReceived(final IoSessionEx session, Object message) throws Exception { if (message == SslFilter.SESSION_SECURED) { IoFilterChain filterChain = session.getFilterChain(); removeFilter(filterChain, certificateSelection); // create session IoSession sslSession = SESSION_KEY.get(session); assert (sslSession == null); SslSession newSslSession = createSslSession(session); SESSION_KEY.set(session, newSslSession); } else if (message == SslFilter.SESSION_UNSECURED) { SslSession sslSession = SESSION_KEY.remove(session); if (sslSession != null && !sslSession.isClosing()) { sslSession.getProcessor().remove(sslSession); } } else { IoSession sslSession = SESSION_KEY.get(session); assert (sslSession != null); IoFilterChain filterChain = sslSession.getFilterChain(); filterChain.fireMessageReceived(message); } }
switch ( type ) { case MESSAGE_RECEIVED: session.getFilterChain().fireMessageReceived(getParameter()); break;
switch ( type ) { case MESSAGE_RECEIVED: session.getFilterChain().fireMessageReceived(getParameter()); break;
public void fire() { switch (getType()) { case MESSAGE_RECEIVED: getSession().getFilterChain().fireMessageReceived(getParameter()); break; case MESSAGE_SENT: