View Javadoc

1   /*******************************************************************************
2    * Copyright (c) 2011 Michael Mimo Moratti.
3    *
4    * Michael Mimo Moratti licenses this file to you under the Apache License, version 2.0
5    * (the "License"); you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at:
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    * Unless required by applicable law or agreed to in writing, software
9    * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
11   * License for the specific language governing permissions and limitations
12   * under the License.
13   *******************************************************************************/
14  package ch.mimo.netty.example.icap.simple;
15  
16  import static org.jboss.netty.channel.Channels.pipeline;
17  
18  import org.jboss.netty.channel.ChannelPipeline;
19  import org.jboss.netty.channel.ChannelPipelineFactory;
20  
21  import ch.mimo.netty.handler.codec.icap.IcapChunkAggregator;
22  import ch.mimo.netty.handler.codec.icap.IcapChunkSeparator;
23  import ch.mimo.netty.handler.codec.icap.IcapRequestEncoder;
24  import ch.mimo.netty.handler.codec.icap.IcapResponseDecoder;
25  
26  public class IcapClientChannelPipeline implements ChannelPipelineFactory {
27  
28  	@Override
29  	public ChannelPipeline getPipeline() throws Exception {
30  		ChannelPipeline pipeline = pipeline();
31      	pipeline.addLast("encoder",new IcapRequestEncoder());
32      	pipeline.addLast("chunkSeparator",new IcapChunkSeparator(4096));
33        	pipeline.addLast("decoder",new IcapResponseDecoder());
34        	pipeline.addLast("chunkAggregator",new IcapChunkAggregator(4096));
35        	pipeline.addLast("handler",new IcapClientHandler());
36        	return pipeline;
37  	}
38  
39  }