Package org.jboss.netty.handler.codec.string

Examples of org.jboss.netty.handler.codec.string.StringDecoder


      }
      List<ChannelBuffer> delims = new ArrayList<ChannelBuffer>();
      delims.add(SEMICOL_DELIM);
      pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(65536, true, true, delims.toArray(new ChannelBuffer[delims.size()])));
      //pipeline.addLast("logger", new LoggingHandler(InternalLogLevel.INFO));
      pipeline.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));
      pipeline.addLast("exec-handler", execHandler);
      pipeline.addLast("submission-handler", submissionHandler);
      pipeline.sendUpstream(new UpstreamMessageEvent(channel, buffer, channel.getRemoteAddress()));
      return null;
    }
View Full Code Here


          true,
          true,
          new ChannelBuffer[]{ChannelBuffers.wrappedBuffer("|".getBytes())}
    );
    // The String decoder is sharable so we wrap it in a simple SharedChannelHandlerProvider
    ChannelHandlerProvider stringDecoder = ChannelHandlerProviderFactory.getInstance("stringDecoder", new StringDecoder());
    // Lastly, we need a "business" handler. It is sharable so we wrap it in a simple SharedChannelHandlerProvider
    ChannelHandlerProvider stringReporter = ChannelHandlerProviderFactory.getInstance("stringReporter", new StringReporter());
   
   
    // We want to send some numbers back to the caller, so we need an ObjectEncoder
View Full Code Here

        bootstrap = new ConnectionlessBootstrap(new NioDatagramChannelFactory());
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline channelPipeline = Channels.pipeline();
                channelPipeline.addLast("StringDecoder", new StringDecoder(CharsetUtil.UTF_8));
                channelPipeline.addLast("ContentHandler", new ContentHandler());
                return channelPipeline;
            }
        });
View Full Code Here

        bootstrap = new ConnectionlessBootstrap(new NioDatagramChannelFactory());
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            @Override
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline channelPipeline = Channels.pipeline();
                channelPipeline.addLast("StringDecoder", new StringDecoder(CharsetUtil.UTF_8));
                channelPipeline.addLast("ContentHandler", new ContentHandler());
                return channelPipeline;
            }
        });
View Full Code Here

        JndiRegistry registry = super.createRegistry();

        // START SNIPPET: registry-beans
        ChannelHandlerFactory lengthDecoder = ChannelHandlerFactories.newLengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4);

        StringDecoder stringDecoder = new StringDecoder();
        registry.bind("length-decoder", lengthDecoder);
        registry.bind("string-decoder", stringDecoder);

        LengthFieldPrepender lengthEncoder = new LengthFieldPrepender(4);
        StringEncoder stringEncoder = new StringEncoder();
View Full Code Here

    public static ChannelHandlerFactory newStringEncoder(Charset charset) {
        return new ShareableChannelHandlerFactory(new StringEncoder(charset));
    }

    public static ChannelHandlerFactory newStringDecoder(Charset charset) {
        return new ShareableChannelHandlerFactory(new StringDecoder(charset));
    }
View Full Code Here

                // are we textline or object?
                if (isTextline()) {
                    Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
                    encoders.add(new StringEncoder(charset));
                    decoders.add(new DelimiterBasedFrameDecoder(decoderMaxLineLength, true, delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter()));
                    decoders.add(new StringDecoder(charset));

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Using textline encoders and decoders with charset: " + charset + ", delimiter: "
                            + delimiter + " and decoderMaxLineLength: " + decoderMaxLineLength);
                    }
View Full Code Here

                // are we textline or object?
                if (isTextline()) {
                    Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
                    encoders.add(new StringEncoder(charset));
                    decoders.add(new DelimiterBasedFrameDecoder(decoderMaxLineLength, true, delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter()));
                    decoders.add(new StringDecoder(charset));

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Using textline encoders and decoders with charset: " + charset + ", delimiter: "
                            + delimiter + " and decoderMaxLineLength: " + decoderMaxLineLength);
                    }
View Full Code Here

                // are we textline or object?
                if (isTextline()) {
                    Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
                    encoders.add(new StringEncoder(charset));
                    decoders.add(new DelimiterBasedFrameDecoder(decoderMaxLineLength, true, delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter()));
                    decoders.add(new StringDecoder(charset));

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Using textline encoders and decoders with charset: {}, delimiter: {} and decoderMaxLineLength: {}",
                                new Object[]{charset, delimiter, decoderMaxLineLength});
                    }
View Full Code Here

                // are we textline or object?
                if (isTextline()) {
                    Charset charset = getEncoding() != null ? Charset.forName(getEncoding()) : CharsetUtil.UTF_8;
                    encoders.add(new StringEncoder(charset));
                    decoders.add(new DelimiterBasedFrameDecoder(decoderMaxLineLength, true, delimiter == TextLineDelimiter.LINE ? Delimiters.lineDelimiter() : Delimiters.nulDelimiter()));
                    decoders.add(new StringDecoder(charset));

                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Using textline encoders and decoders with charset: {}, delimiter: {} and decoderMaxLineLength: {}",
                                new Object[]{charset, delimiter, decoderMaxLineLength});
                    }
View Full Code Here

TOP

Related Classes of org.jboss.netty.handler.codec.string.StringDecoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.