The smallest Java web server

I need a simple web server to write a minimal web interface for the application. It should be something really different, like Webrick from the Ruby standard library or BaseHTTPServer from the Python standard library, just a way to save the server by listening to the port and respond to GET requests with a string.

thanks

+6
source share
8 answers

NanoHTTPD

Try NanoHTTPD . I used it for Android .

NanoHTTPD is a lightweight HTTP server designed to be embedded in other applications released under the Modified BSD license.

+8
source

Jetty

Jetty is what I personally prefer. It has a small amount of memory, easily integrates with Eclipse, can be used as a built-in Maven server.

Additionally you can see the Mini Web Server

+9
source

com.sun.net.httpserver

A very cheap alternative:

Sun Java comes with its httpserver package since java 1.6

Provides a simple high-level HTTP server API that you can use to create embedded HTTP servers. Both "http" and "https" are supported.

+4
source

You did not say whether you want single-threaded or multi-threaded, so here too:

Single Threaded Java Web Server

Java multithreaded web server

+3
source

Spark

Microstructure for building web applications in Kotlin and Java 8 with minimal effort

For Java 8 and later: http://sparkjava.com/

+2
source

accepts a framework

Try accepting the formula :

 new FtBasic(new TkText("hello, world!"), 8080).start(Exit.NEVER); 
+2
source

Grizzly Project

I recommend the Grizzly web server .

+1
source

Winstone: http://winstone.sourceforge.net (Jar executable, 330 KB executable, single-line file server, TLS, AJP support, ...)

0
source

Source: https://habr.com/ru/post/904136/


All Articles