org.simpleframework.http.core

## Class ContainerServer

- java.lang.Object
- - org.simpleframework.http.core.ContainerServer

All Implemented Interfaces:
  Server

    public class ContainerServer
    extends java.lang.Object
    implements Server

The `ContainerServer` object provides a processor that dispatch requests from a connected pipeline. SSL connections and plain connections can be processed by this implementation. It collects data from the connected pipelines and constructs the requests and responses used to dispatch to the container.

In order to process the requests this uses two thread pools. One is used to collect data from the pipelines and create the requests. The other is used to service those requests. Such an architecture ensures that the serving thread does not have to deal with I/O operations. All data is consumed before it is serviced.

Author:
  Niall Gallagher

### Constructor Summary

Constructors
Constructor and Description
`ContainerServer(Container container)` Constructor for the `ContainerServer` object.
`ContainerServer(Container container, Allocator allocator)` Constructor for the `ContainerServer` object.
`ContainerServer(Container container, Allocator allocator, int count)` Constructor for the `ContainerServer` object.
`ContainerServer(Container container, int count)` Constructor for the `ContainerServer` object.

### Method Summary

Methods
`void` `process(Socket socket)` Used to process the `Socket` which is a full duplex communication link that may contain several HTTP requests.
`void` `stop()` This method is used to stop the `Processor` such that it will accept no more pipelines.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ContainerServer

    public ContainerServer(Container container)
                    throws java.io.IOException

Constructor for the `ContainerServer` object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.

Parameters:
  `container` - this is the container used to service requests
Throws:
  `java.io.IOException`

#### ContainerServer

    public ContainerServer(Container container,
                   int count)
                    throws java.io.IOException

Constructor for the `ContainerServer` object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.

Parameters:
  `container` - this is the container used to service requests
  `count` - this is the number of threads used for each pool
Throws:
  `java.io.IOException`

#### ContainerServer

    public ContainerServer(Container container,
                   Allocator allocator)
                    throws java.io.IOException

Constructor for the `ContainerServer` object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.

Parameters:
  `container` - this is the container used to service requests
  `allocator` - this is the allocator used to create buffers
Throws:
  `java.io.IOException`

#### ContainerServer

    public ContainerServer(Container container,
                   Allocator allocator,
                   int count)
                    throws java.io.IOException

Constructor for the `ContainerServer` object. The processor created will collect HTTP requests from the pipelines provided and dispatch those requests to the provided container.

Parameters:
  `container` - this is the container used to service requests
  `allocator` - this is the allocator used to create buffers
  `count` - this is the number of threads used for each pool
Throws:
  `java.io.IOException`

### Method Detail

#### process

    public void process(Socket socket)
                 throws java.io.IOException

Used to process the `Socket` which is a full duplex communication link that may contain several HTTP requests. This will be used to read the requests from the `Socket` and to pass these requests to a `Container` for processing.

Typical usage of this method is to accept multiple pipeline objects, each representing a unique HTTP channel to the client, and process requests from those pipelines concurrently.

Specified by:
  `process` in interface `Server`
Parameters:
  `socket` - this is the connected HTTP pipeline to process
Throws:
  `java.io.IOException`

#### stop

    public void stop()
              throws java.io.IOException

This method is used to stop the `Processor` such that it will accept no more pipelines. Stopping the processor ensures that all resources occupied will be released. This is required so that all threads are stopped, and all memory is released.

Typically this method is called once all connections to the server have been stopped. As a final act of shutting down the entire server all threads must be stopped, this allows collection of unused memory and the closing of file and socket resources.

Specified by:
  `stop` in interface `Server`
Throws:
  `java.io.IOException`