use of com.generallycloud.baseio.container.BlackIPFilter 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());
}
use of com.generallycloud.baseio.container.BlackIPFilter in project baseio by generallycloud.
the class ProtobaseApplicationContextEnricher method enrich.
@Override
public void enrich(ApplicationContext context) {
SocketChannelContext channelContext = context.getChannelContext();
context.setServiceFilter(new FutureAcceptorServiceFilter());
// FIXME 重复的
Set<String> blackIPs = context.getBlackIPs();
if (blackIPs != null && !blackIPs.isEmpty()) {
channelContext.addSessionEventListener(new BlackIPFilter(blackIPs));
}
channelContext.addSessionEventListener(new LoggerSocketSEListener());
channelContext.setProtocolFactory(new ParamedProtobaseProtocolFactory());
channelContext.setBeatFutureFactory(new ParamedProtobaseBeatFutureFactory());
}
Aggregations