@Override public void doSessionCreated(IoSessionEx session) throws Exception { LoggingFilter.addIfNeeded(logger, session, transportName); super.doSessionCreated(session); }
protected void logExceptionCaught(IoSession session, Throwable cause) { String causeMessage = cause.toString(); if (cause.getCause() != null) { causeMessage += ", caused by " + cause.getCause().toString(); } getExceptionCaughtStrategy(cause).log(logger, String.format(exceptionFormat, session.getId(), causeMessage), cause); }
protected void logFilterWrite(IoSession session, Object message) { if (getFilterWriteStrategy().shouldLog(logger)) { if (message instanceof Message) { message = ((Message) message).toVerboseString(); } getFilterWriteStrategy().log(logger, writeFormat, session.getId(), message); } }
private void addLoggerFilter(T session, Logger logger) { if (logger != null) { // setup logging filters for the new session LoggingFilter.addIfNeeded(logger, session, getTransportMetadata().getName()); if (session.getParent() != null) { LoggingFilter.moveAfterCodec(session.getParent()); } } }
@SuppressWarnings("deprecation") @Override public void addBridgeFilters(IoFilterChain chain) { IoSession transport = chain.getSession(); SocketAddress localAddress = transport.getLocalAddress(); String nextProtocol = PROTOCOL_HTTP_1_1; if (localAddress instanceof ResourceAddress) { ResourceAddress address = (ResourceAddress) localAddress; if (!address.hasOption(QUALIFIER)) { nextProtocol = address.getOption(NEXT_PROTOCOL); } } assert nextProtocol != null; Set<HttpConnectFilter> connectFilters = connectFiltersByProtocol.get(nextProtocol); assert (connectFilters != null && !connectFilters.isEmpty()); for (HttpConnectFilter connectFilter : connectFilters) { chain.addLast(connectFilter.filterName(), connectFilter.filter()); } LoggingFilter.moveAfterCodec(transport); }
public LoggingFilter(Logger logger, IoSession session, String transportName) { this(logger, getLoggingFormat(session, transportName)); }
protected void logMessageReceived(IoSession session, Object message) { if (getMessageReceivedStrategy().shouldLog(logger)) { if (message instanceof Message) { message = ((Message) message).toVerboseString(); } getMessageReceivedStrategy().log(logger, receivedFormat, session.getId(), message); } }
protected void logMessageSent(IoSession session, Object message) { if (getMessageSentStrategy().shouldLog(logger)) { if (message instanceof Message) { message = ((Message) message).toVerboseString(); } getMessageSentStrategy().log(logger, sentFormat, session.getId(), message); } }
protected void logSessionClosed(IoSession session) { getSessionClosedStrategy().log(logger, closedFormat, session.getId(), session); }
protected void logSessionCreated(IoSession session) { getSessionCreatedStrategy().log(logger, createdFormat, session.getId(), session); }
@Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { // GL.debug("http", getClass().getSimpleName() + " request received."); // The HttpPostUpgradeFilter prevents a bug where a 101 WebSocket upgrade response also includes // a WebSocket frame in the same packet. IoFilterChain filterChain = session.getFilterChain(); filterChain.remove(HttpCodecFilter.class); // Give logging filter a chance to move after any remaining codec LoggingFilter.moveAfterCodec(session); // Fire message down the pipeline super.messageReceived(nextFilter, session, message); // We've done our job, so remove ourselves from the filter chain if (filterChain.contains(this)) { filterChain.remove(this); } } }
@Override public void sessionCreated(IoSession session) throws Exception { LoggingFilter.addIfNeeded(logger, session, getTransportName()); super.sessionCreated(session); } });
@Override public void sessionCreated(IoSession session) throws Exception { LoggingFilter.addIfNeeded(logger, session, getTransportName()); super.sessionCreated(session); } });
@Override protected void doSessionCreated(IoSessionEx session) throws Exception { LoggingFilter.addIfNeeded(logger, session, transportName); ResourceAddress candidateAddress = getCandidateResourceAddress(session); NextProtocolBindings.NextProtocolBinding nextBinding = bindings.getBinding0(candidateAddress); if (nextBinding == null) { // next-protocol not currently bound for this address session.close(true); return; } SortedSet<String> nextProtocolNames = nextBinding.getNextProtocolNames(); if (nextProtocolNames == null || nextProtocolNames.isEmpty()) { NEXT_PROTOCOL_KEY.set(session, null); } else if (nextProtocolNames.size() == 1) { NEXT_PROTOCOL_KEY.set(session, nextProtocolNames.first()); } else { Collection<ProtocolDispatcher> dispatchers = bridgeServiceFactory.getTransportFactory().getProtocolDispatchers().values(); // sessionCreated will be sent down pipeline again when next-protocol has been determined NextProtocolFilter nextProtocol = new NextProtocolFilter(dispatchers); IoFilterChain filterChain = session.getFilterChain(); filterChain.addLast(AbstractNioAcceptor.NEXT_PROTOCOL_FILTER, nextProtocol); } }
@Override public void sessionCreated(IoSession session) throws Exception { LoggingFilter.addIfNeeded(logger, session, transportName);