Opened 4 years ago
Last modified 4 years ago
#20734 new enhancement
Use com.sun.net.httpserver.HttpServer
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core remotecontrol | Version: | |
Keywords: | Cc: |
Description
Javadoc for com.sun.net.httpserver.HttpServer
This class implements a simple HTTP server.
https://www.mail-archive.com/net-dev@openjdk.java.net/msg15422.html
Around 10% of the com.sun namespace is supported for use outside the JDK. Examples of supported com.sun APIs include:
- The Compiler Tree API (four com.sun packages exported by the jdk.compiler module)
- The HTTP Server API (two com.sun packages exported by the jdk.httpserver module)
- The SCTP API (the com.sun.nio.sctp package exported by the jdk.sctp module)
- JDK-specific extensions to the NIO API (the com.sun.nio.file package exported by the jdk.unsupported module)
You can view a list of the internal com.sun packages and the supported com.sun packages at https://cr.openjdk.java.net/~mr/jigsaw/jdk8-packages-strongly-encapsulated
Somewhat related: JEP 408: Simple Web Server – https://openjdk.java.net/jeps/408
Provide a command-line tool to start a minimal web server that serves static files in the current directory. This low-threshold utility will be useful for prototyping, ad-hoc coding, and testing purposes, particularly in educational contexts.
Please note this class is in
jdk.httpserver
module in Java 9+ so it might require some additional command line arguments in launchers (junit, jnlp, macos, linux, etc.)