Search in sources :

Example 1 with DelimiterBasedFrameDecoder

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());
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) MultilineOrientedResponseDecoder(org.opennms.netmgt.provision.detector.simple.support.MultilineOrientedResponseDecoder) DelimiterBasedFrameDecoder(org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) LineOrientedRequestEncoder(org.opennms.netmgt.provision.detector.simple.support.LineOrientedRequestEncoder)

Example 2 with DelimiterBasedFrameDecoder

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);
}
Also used : DelimiterBasedFrameDecoder(org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder) ChannelBuffer(org.jboss.netty.buffer.ChannelBuffer)

Example 3 with DelimiterBasedFrameDecoder

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;
}
Also used : DelimiterBasedFrameDecoder(org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder) ChannelHandler(org.jboss.netty.channel.ChannelHandler) Callable(java.util.concurrent.Callable)

Example 4 with DelimiterBasedFrameDecoder

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());
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) DelimiterBasedFrameDecoder(org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) LineOrientedRequestEncoder(org.opennms.netmgt.provision.detector.simple.support.LineOrientedRequestEncoder) LineOrientedResponseDecoder(org.opennms.netmgt.provision.detector.simple.support.LineOrientedResponseDecoder)

Aggregations

DelimiterBasedFrameDecoder (org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder)4 StringDecoder (org.jboss.netty.handler.codec.string.StringDecoder)2 StringEncoder (org.jboss.netty.handler.codec.string.StringEncoder)2 LineOrientedRequestEncoder (org.opennms.netmgt.provision.detector.simple.support.LineOrientedRequestEncoder)2 Callable (java.util.concurrent.Callable)1 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)1 ChannelHandler (org.jboss.netty.channel.ChannelHandler)1 LineOrientedResponseDecoder (org.opennms.netmgt.provision.detector.simple.support.LineOrientedResponseDecoder)1 MultilineOrientedResponseDecoder (org.opennms.netmgt.provision.detector.simple.support.MultilineOrientedResponseDecoder)1