le-annen.javaserver.0.1.source-code.Main Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javaserver Show documentation
Show all versions of javaserver Show documentation
A minimal java http server which fulfills small portions of the
http specifications. This is not a full fledged or secure server. It should only be used
for learning purposes and contains no guarantees of any king.
The newest version!
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Main {
public static void main(String[] args) {
ExecutorService requestExecutor = Executors.newFixedThreadPool(10);
ReadRequest readRequest = new ReadRequest();
SendResponse sendResponse = new SendResponse();
Router router = new Router();
Logger logger = new Logger();
Server httpServer = new Server(
args,
requestExecutor,
readRequest,
sendResponse,
router,
logger);
Runtime.getRuntime().addShutdownHook(new ShutdownHook(httpServer, requestExecutor));
httpServer.run();
}
}