Interface Server
-
- All Known Implementing Classes:
ContainerServer
,ProcessorServer
public interface Server
TheServer
interface represents a handler that is used to processSocket
objects. Implementations of this object will read HTTP requests for the provided sockets and dispatch the requests for processing by the core protocol handler.The intended use of a
Server
is that it be used in conjunction with aContainer
object, which acts as the primary protocol handler for a server. Typically the server will deliver callbacks to a container with bothRequest
andResponse
objects encapsulating the transaction.Core responsibilities of the server are to manage connections, to ensure that all HTTP requests are collected, and to dispatch the collected requests to an appropriate handler. It is also required to manage multiplexing such that many connections can be processed concurrently without a high latency period.
- Author:
- Niall Gallagher
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
process(Socket socket)
Used to process theSocket
which is a full duplex communication link that may contain several HTTP requests.void
stop()
This method is used to stop theServer
such that it will accept no more sockets.
-
-
-
Method Detail
-
process
void process(Socket socket) throws java.io.IOException
Used to process theSocket
which is a full duplex communication link that may contain several HTTP requests. This will be used to read the requests from theSocket
and to pass these requests to aContainer
for processing.Typical usage of this method is to accept multiple sockets objects, each representing a unique HTTP channel to the client, and process requests from those sockets concurrently.
- Parameters:
socket
- this is the connected HTTP socket to process- Throws:
java.io.IOException
-
stop
void stop() throws java.io.IOException
This method is used to stop theServer
such that it will accept no more sockets. Stopping the server 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.
- Throws:
java.io.IOException
-
-