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.preview;
    15
    16  import java.net.InetSocketAddress;
    17  import java.util.concurrent.Executors;
    18
    19  import org.jboss.netty.bootstrap.ServerBootstrap;
    20  import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
    21
    22  /**
    23   * An ICAP Server that prints the preview request asks for the rest via
    24   * 100 contine prints that and responds with 204 Non Content.
    25   *
    26   *
    27   * @author Michael Mimo Moratti (mimo@mimo.ch)
    28   *
    29   */
    30  public class IcapServer {
    31
    32  	public static void main(String[] args) {
    33          // Configure the server.
    34          ServerBootstrap bootstrap = new ServerBootstrap(
    35                  new NioServerSocketChannelFactory(
    36                          Executors.newCachedThreadPool(),
    37                          Executors.newCachedThreadPool()));
    38
    39          // Set up the event pipeline factory.
    40          bootstrap.setPipelineFactory(new IcapServerChannelPipeline());
    41
    42          // Bind and start to accept incoming connections.
    43          bootstrap.bind(new InetSocketAddress(8099));
    44  	}
    45  }