httpd is a simple HTTP Server in Java. Open Source project under Apache License v2.0
Current Stable Version is 1.1.2
java -jar httpd-x.x.x.jar <tcp-port> <directory|zipfile>
HttpServer srv = new HttpServer(8080, "/srv/wwwroot/");
srv.setReadTimeoutMillis(180000);
srv.start();
// ...
srv.stop();
Add the dependency to your pom.xml:
<dependency>
<groupId>org.javastack</groupId>
<artifactId>httpd</artifactId>
<version>1.1.2</version>
</dependency>
Inspired in Apache HTTPD, this code is Java-minimalistic version.