Search in sources :

Example 1 with FutureAcceptorHttpFilter

use of com.generallycloud.baseio.container.http11.service.FutureAcceptorHttpFilter in project baseio by generallycloud.

the class HttpApplicationContextEnricher method enrich.

@Override
public void enrich(ApplicationContext context) {
    SocketChannelContext channelContext = context.getChannelContext();
    context.setServiceFilter(new FutureAcceptorHttpFilter());
    context.setExceptionCaughtHandle(new HttpExceptionCaughtHandle());
    // FIXME 重复的
    Set<String> blackIPs = context.getBlackIPs();
    if (blackIPs != null && !blackIPs.isEmpty()) {
        channelContext.addSessionEventListener(new BlackIPFilter(blackIPs));
    }
    channelContext.setBeatFutureFactory(new WebSocketBeatFutureFactory());
    channelContext.addSessionEventListener(new LoggerSocketSEListener());
    channelContext.addSessionIdleEventListener(new SocketSessionAliveSEListener());
    channelContext.setProtocolFactory(new ServerHTTPProtocolFactory());
}
Also used : LoggerSocketSEListener(com.generallycloud.baseio.component.LoggerSocketSEListener) SocketSessionAliveSEListener(com.generallycloud.baseio.component.SocketSessionAliveSEListener) BlackIPFilter(com.generallycloud.baseio.container.BlackIPFilter) FutureAcceptorHttpFilter(com.generallycloud.baseio.container.http11.service.FutureAcceptorHttpFilter) SocketChannelContext(com.generallycloud.baseio.component.SocketChannelContext) ServerHTTPProtocolFactory(com.generallycloud.baseio.codec.http11.ServerHTTPProtocolFactory) WebSocketBeatFutureFactory(com.generallycloud.baseio.codec.http11.future.WebSocketBeatFutureFactory)

Aggregations

ServerHTTPProtocolFactory (com.generallycloud.baseio.codec.http11.ServerHTTPProtocolFactory)1 WebSocketBeatFutureFactory (com.generallycloud.baseio.codec.http11.future.WebSocketBeatFutureFactory)1 LoggerSocketSEListener (com.generallycloud.baseio.component.LoggerSocketSEListener)1 SocketChannelContext (com.generallycloud.baseio.component.SocketChannelContext)1 SocketSessionAliveSEListener (com.generallycloud.baseio.component.SocketSessionAliveSEListener)1 BlackIPFilter (com.generallycloud.baseio.container.BlackIPFilter)1 FutureAcceptorHttpFilter (com.generallycloud.baseio.container.http11.service.FutureAcceptorHttpFilter)1