use of org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder in project opennms by OpenNMS.
the class AsyncMultilineDetectorNettyImpl method appendToPipeline.
@Override
protected void appendToPipeline(ChannelPipeline retval) {
// Upstream handlers
retval.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, Delimiters.lineDelimiter()));
retval.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));
retval.addLast("multilineDecoder", new MultilineOrientedResponseDecoder());
// Downstream handlers
retval.addLast("stringEncoder", new StringEncoder(CharsetUtil.UTF_8));
retval.addLast("lineEncoder", new LineOrientedRequestEncoder());
}
use of org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder in project graylog2-server by Graylog2.
the class SyslogTCPFramingRouterHandler method messageReceived.
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
final ChannelBuffer message = (ChannelBuffer) e.getMessage();
if (!message.readable()) {
return;
}
if (!routed) {
if (usesOctetCountFraming(message)) {
ctx.getPipeline().addAfter(ctx.getName(), "framer-octet", new SyslogOctetCountFrameDecoder());
} else {
ctx.getPipeline().addAfter(ctx.getName(), "framer-delimiter", new DelimiterBasedFrameDecoder(maxFrameLength, delimiter));
}
routed = true;
}
ctx.sendUpstream(e);
}
use of org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder in project graylog2-server by Graylog2.
the class TcpTransport method getFinalChannelHandlers.
@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getFinalChannelHandlers(MessageInput input) {
final LinkedHashMap<String, Callable<? extends ChannelHandler>> finalChannelHandlers = Maps.newLinkedHashMap();
finalChannelHandlers.put("framer", new Callable<ChannelHandler>() {
@Override
public ChannelHandler call() throws Exception {
return new DelimiterBasedFrameDecoder(maxFrameLength, delimiter);
}
});
finalChannelHandlers.putAll(super.getFinalChannelHandlers(input));
return finalChannelHandlers;
}
use of org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder in project opennms by OpenNMS.
the class AsyncLineOrientedDetectorNettyImpl method appendToPipeline.
@Override
protected void appendToPipeline(ChannelPipeline retval) {
// Upstream handlers
retval.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, Delimiters.lineDelimiter()));
retval.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));
retval.addLast("lineDecoder", new LineOrientedResponseDecoder());
// Downstream handlers
retval.addLast("stringEncoder", new StringEncoder(CharsetUtil.UTF_8));
retval.addLast("lineEncoder", new LineOrientedRequestEncoder());
}
Aggregations