|
| 1 | + |
1 | 2 | # httpserver
|
2 | 3 |
|
3 | 4 | Zero-dependency implementation of the JDK [`com.sun.net.httpserver.HttpServer` specification](https://docs.oracle.com/en/java/javase/21/docs/api/jdk.httpserver/com/sun/net/httpserver/package-summary.html) with a few significant enhancements.
|
@@ -31,6 +32,17 @@ Additional proxy and websockets tests are included.
|
31 | 32 |
|
32 | 33 | The http2 implementation passes all specification tests in [h2spec](https://github.com/summerwind/h2spec)
|
33 | 34 |
|
| 35 | +## maven |
| 36 | +[](https://mvnrepository.com/artifact/io.github.robaho/httpserver) |
| 37 | + |
| 38 | +```xml |
| 39 | +<dependency> |
| 40 | + <groupId>io.github.robaho</groupId> |
| 41 | + <artifactId>httpserver</artifactId> |
| 42 | + <version>1.0.19</version> |
| 43 | +</dependency> |
| 44 | +``` |
| 45 | + |
34 | 46 | ## using
|
35 | 47 |
|
36 | 48 | The JDK will automatically use `robaho.net.httpserver.DefaultHttpServerProvider` instead of the JDK implementation when the jar is placed on the class/module path. If there are multiple `HttpServer` providers on the classpath, the `com.sun.net.httpserver.HttpServerProvider` system property can be used to specify the correct one:
|
@@ -86,6 +98,16 @@ gradle runSimpleFileServer
|
86 | 98 |
|
87 | 99 | All logging is performed using the [Java System Logger](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/System.Logger.html)
|
88 | 100 |
|
| 101 | +## enable Http2 |
| 102 | + |
| 103 | +Http2 support is enabled via Java system properties. |
| 104 | + |
| 105 | +Use `-Drobaho.net.httpserver.http2OverSSL=true` to enable Http2 only via SSL connections. |
| 106 | + |
| 107 | +Use `-Drobaho.net.httpserver.http2OverNonSSL=true` to enable Http2 on Non-SSL connections (which requires prior knowledge). The Http2 upgrade mechanism was deprecated in RFC 9113 so it is not supported. |
| 108 | + |
| 109 | +See the additional Http2 options in `ServerConfig.java` |
| 110 | + |
89 | 111 | ## performance
|
90 | 112 |
|
91 | 113 | This version performs more than **10x** faster than the JDK version when tested using the [Tech Empower Benchmarks](https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Java/httpserver) on an identical hardware/work setup with the same JDK 23 version.<sup>1</sup>
|
@@ -288,25 +310,6 @@ Reply Errors: 0
|
288 | 310 |
|
289 | 311 | The counts and rates for non "Total" statistics are reset with each pull of the statistics.
|
290 | 312 |
|
291 |
| -## maven |
292 |
| - |
293 |
| -```xml |
294 |
| -<dependency> |
295 |
| - <groupId>io.github.robaho</groupId> |
296 |
| - <artifactId>httpserver</artifactId> |
297 |
| - <version>1.0.19</version> |
298 |
| -</dependency> |
299 |
| -``` |
300 |
| -## enable Http2 |
301 |
| - |
302 |
| -Http2 support is enabled via Java system properties. |
303 |
| - |
304 |
| -Use `-Drobaho.net.httpserver.http2OverSSL=true` to enable Http2 only via SSL connections. |
305 |
| - |
306 |
| -Use `-Drobaho.net.httpserver.http2OverNonSSL=true` to enable Http2 on Non-SSL connections (which requires prior knowledge). The Http2 upgrade mechanism was deprecated in RFC 9113 so it is not supported. |
307 |
| - |
308 |
| -See the additional Http2 options in `ServerConfig.java` |
309 |
| - |
310 | 313 | ## performance notes
|
311 | 314 |
|
312 | 315 | Http2 performance has not been fully optimized. The http2 version is about 20-30% slower than http1. I expect this to be the case with most http2 implementations due to the complexity.
|
|
0 commit comments