Refine search
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_AGGREGATE_SIZE)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new CoordinatorAdminRequestHandler(storeClientConfigs)); return pipeline; }
@Override protected void encodeInitialLine(ChannelBuffer buf, HttpMessage message) throws Exception { HttpResponse response = (HttpResponse) message; encodeAscii(response.getProtocolVersion().toString(), buf); buf.writeByte(SP); encodeAscii(String.valueOf(response.getStatus().getCode()), buf); buf.writeByte(SP); encodeAscii(String.valueOf(response.getStatus().getReasonPhrase()), buf); buf.writeByte(CR); buf.writeByte(LF); } }
@Override public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); // Uncomment the following line if you want HTTPS //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine(); //engine.setUseClientMode(false); //pipeline.addLast("ssl", new SslHandler(engine)); pipeline.addLast("decoder", new HttpRequestDecoder()); //pipeline.addLast("aggregator", new HttpChunkAggregator(65536)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("sseEventEncoder", sseEventEncoder); //pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("handler", this); return pipeline; }
ChannelPipeline pipeline = Channels.pipeline(); HttpRequestDecoder requestDecoder = new HttpRequestDecoder(transport.maxInitialLineLength, transport.maxHeaderSize, transport.maxChunkSize); if (transport.maxCumulationBufferCapacity > 0) { requestDecoder.setMaxCumulationBufferCapacity((int) transport.maxCumulationBufferCapacity); requestDecoder.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); pipeline.addLast("decoder", requestDecoder); if (transport.compression) { pipeline.addLast("decoder_compress", new HttpContentDecompressor()); HttpChunkAggregator httpChunkAggregator = new HttpChunkAggregator(transport.maxContentLength); if (transport.maxCompositeBufferComponents != -1) { httpChunkAggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); pipeline.addLast("aggregator", httpChunkAggregator); pipeline.addLast("encoder", new HttpResponseEncoder()); if (transport.compression) { pipeline.addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel));
@Override protected Object decode(final ChannelHandlerContext ctx, final Channel chan, final ChannelBuffer buffer) throws Exception { if (buffer.readableBytes() < 1) { // Yes sometimes we can be called return null; // with an empty buffer... } final int firstbyte = buffer.getUnsignedByte(buffer.readerIndex()); final ChannelPipeline pipeline = ctx.getPipeline(); // None of the commands in the RPC protocol start with a capital ASCII // letter for the time being, and all HTTP commands do (GET, POST, etc.) // so use this as a cheap way to differentiate the two. if ('A' <= firstbyte && firstbyte <= 'Z') { pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("encoder", new HttpResponseEncoder()); } else { pipeline.addLast("framer", new LineBasedFrameDecoder(1024)); pipeline.addLast("encoder", ENCODER); pipeline.addLast("decoder", DECODER); } pipeline.remove(this); pipeline.addLast("handler", rpchandler); // Forward the buffer to the next handler. return buffer.readBytes(buffer.readableBytes()); }
@Override public ChannelPipeline getPipeline() throws Exception { return Channels.pipeline( new HttpRequestDecoder(), new HttpChunkAggregator(1 << 16), new HttpResponseEncoder(), new ChunkedWriteHandler(), shuffleHandler); } }
@Override public ChannelPipeline getPipeline() throws Exception { return pipeline(new HttpRequestDecoder(), new HttpResponseEncoder(), new HttpChildChannelSource(httpBindings)); }
@Override public ChannelHandler call() throws Exception { return new HttpResponseEncoder(); } });
@Override protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception { Object retVal = super.encode(ctx, channel, msg); if (retVal instanceof CompositeChannelBuffer) { CompositeChannelBuffer ccb = (CompositeChannelBuffer) retVal; if (ccb.useGathering() != Netty3Utils.DEFAULT_GATHERING) { List<ChannelBuffer> decompose = ccb.decompose(ccb.readerIndex(), ccb.readableBytes()); return ChannelBuffers.wrappedBuffer(Netty3Utils.DEFAULT_GATHERING, decompose.toArray(new ChannelBuffer[decompose.size()])); } } return retVal; } }
@Override public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); // Uncomment the following line if you want HTTPS //SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine(); //engine.setUseClientMode(false); //pipeline.addLast("ssl", new SslHandler(engine)); pipeline.addLast("decoder", new HttpRequestDecoder()); //pipeline.addLast("aggregator", new HttpChunkAggregator(65536)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("sseEventEncoder", sseEventEncoder); //pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("handler", this); return pipeline; }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); pipeline.addLast("openChannels", transport.serverOpenChannels); HttpRequestDecoder requestDecoder = new HttpRequestDecoder( (int) transport.maxInitialLineLength.bytes(), (int) transport.maxHeaderSize.bytes(), if (transport.maxCumulationBufferCapacity != null) { if (transport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) { requestDecoder.setMaxCumulationBufferCapacity(Integer.MAX_VALUE); } else { requestDecoder.setMaxCumulationBufferCapacity((int) transport.maxCumulationBufferCapacity.bytes()); requestDecoder.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); pipeline.addLast("decoder", requestDecoder); if (transport.compression) { pipeline.addLast("decoder_compress", new HttpContentDecompressor()); HttpChunkAggregator httpChunkAggregator = new HttpChunkAggregator((int) transport.maxContentLength.bytes()); if (transport.maxCompositeBufferComponents != -1) { httpChunkAggregator.setMaxCumulationBufferComponents(transport.maxCompositeBufferComponents); pipeline.addLast("aggregator", httpChunkAggregator); pipeline.addLast("encoder", new HttpResponseEncoder()); if (transport.compression) { pipeline.addLast("encoder_compress", new HttpContentCompressor(transport.compressionLevel));
@Override public ChannelPipeline getPipeline() throws Exception { return Channels.pipeline(new HttpRequestDecoder(), new HttpChunkAggregator(65536), new HttpResponseEncoder(), new CredentialsLogicHandler(token, url.toString())); } });
@Override public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); pipeline.addLast("connectionStats", connectionStatsHandler); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(maxHttpContentLength)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new RestServerRequestHandler(storeRepository)); pipeline.addLast("storageExecutionHandler", storageExecutionHandler); return pipeline; }
public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); // Uncomment the following line if you want HTTPS // SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine(); // engine.setUseClientMode(false); // pipeline.addLast("ssl", new SslHandler(engine)); pipeline.addLast("decoder", new HttpRequestDecoder()); // Uncomment the following line if you don't want to handle HttpChunks. // pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); pipeline.addLast("encoder", new HttpResponseEncoder()); // Remove the following line if you don't want automatic content compression. pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new HelloWorldServerHandler()); return pipeline; } }
/** * Add all {@link ChannelHandler}'s that are needed for HTTP. */ protected void addHttpHandlers(ChannelHandlerContext ctx) { ChannelPipeline pipeline = ctx.getPipeline(); pipeline.addLast("httpRequestDecoder", new HttpRequestDecoder()); pipeline.addLast("httpResponseEncoder", new HttpResponseEncoder()); pipeline.addLast("httpChunkAggregator", new HttpChunkAggregator(maxHttpContentLength)); pipeline.addLast("httpRequestHandler", createHttpRequestHandlerForHttp()); }
@Override public ChannelPipeline getPipeline() throws Exception { final ChannelPipeline pipeline = pipeline(); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("handler", new HttpGnipServerHandler(chunkedInputFactory.getChunkedInput())); return pipeline; }
@Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = Channels.pipeline(); if (sslFactory != null) { pipeline.addLast("ssl", new SslHandler(sslFactory.createSSLEngine())); } pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1 << 16)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunking", new ChunkedWriteHandler()); pipeline.addLast("shuffle", SHUFFLE); pipeline.addLast("idle", idleStateHandler); pipeline.addLast(TIMEOUT_HANDLER, new TimeoutHandler()); return pipeline; // TODO factor security manager into pipeline // TODO factor out encode/decode to permit binary shuffle // TODO factor out decode of index to permit alt. models }
@Override public ChannelPipeline getPipeline() throws Exception { final ChannelPipeline pipeline = Channels.pipeline(); if (configuration.isRestEnableTls()) { pipeline.addLast("tls", buildSslHandler()); } pipeline.addLast("decoder", new HttpRequestDecoder(maxInitialLineLength, maxHeaderSize, maxChunkSize)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("chunks", new ChunkedWriteHandler()); pipeline.addLast("executor", new ExecutionHandler(executor)); pipeline.addLast("jerseyHandler", jerseyHandler); return pipeline; }
@Override public ChannelPipeline getPipeline() throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = pipeline(); pipeline.addLast("connectionStats", connectionStatsHandler); pipeline.addLast("decoder", new HttpRequestDecoder(this.coordinatorConfig.getHttpMessageDecoderMaxInitialLength(), this.coordinatorConfig.getHttpMessageDecoderMaxHeaderSize(), this.coordinatorConfig.getHttpMessageDecoderMaxChunkSize())); pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new RestCoordinatorRequestHandler(fatClientMap)); pipeline.addLast("coordinatorExecutionHandler", coordinatorExecutionHandler); return pipeline; } }
ChannelPipeline p = pipeline(); p.addLast("idle-detection", IDLE_STATE_HANDLER); p.addLast("http-decoder", new HttpRequestDecoder()); p.addLast("http-encoder", new HttpResponseEncoder()); p.addLast("keep-alive", KEEP_ALIVE_HANDLER); p.addLast("responder", new ChannelUpstreamHandler() {