The server is an HttpServer bound to a given address. It comes with an HttpHandler that serves files from a given directory path (and its subdirectories) on the default file system, and an optional Filter that prints log messages related to the exchanges handled by the server to a given output stream.
Unless specified as arguments, the default values are:
The implementation is provided via the main entry point of the jdk.httpserver module.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private static boolean | |
| private static final SimpleFileServer. | |
| private static final int | |
| private static final Path | |
| private static final InetAddress |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static Path | |
| pack-priv static int | Returns: startup status codethe writer to which output should be written writer, String the launcher the server is started from launcher, String[] the command line options args)Starts a simple HTTP file server created on a directory. |
| addrSpecified | back to summary |
|---|---|
| private static boolean addrSpecified | |
| DEFAULT_OUTPUT_LEVEL | back to summary |
|---|---|
| private static final SimpleFileServer. | |
| DEFAULT_PORT | back to summary |
|---|---|
| private static final int DEFAULT_PORT | |
| DEFAULT_ROOT | back to summary |
|---|---|
| private static final Path DEFAULT_ROOT | |
| LOOPBACK_ADDR | back to summary |
|---|---|
| private static final InetAddress LOOPBACK_ADDR | |
| SimpleFileServerImpl | back to summary |
|---|---|
| private SimpleFileServerImpl() | |
| realPath | back to summary |
|---|---|
| private static Path realPath(Path root) | |
| start | back to summary |
|---|---|
| pack-priv static int start(PrintWriter writer, String launcher, String[] args) Starts a simple HTTP file server created on a directory.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final PrintWriter |
| Access | Constructor and Description |
|---|---|
| private | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void |
| writer | back to summary |
|---|---|
| private final PrintWriter writer | |
| Out | back to summary |
|---|---|
| private Out() | |
| Out | back to summary |
|---|---|
| pack-priv Out(PrintWriter writer) | |
| flush | back to summary |
|---|---|
| pack-priv void flush() | |
| printStartMessage | back to summary |
|---|---|
| pack-priv void printStartMessage(Path root, HttpServer server) throws UnknownHostException | |
| reportError | back to summary |
|---|---|
| pack-priv void reportError(String message) | |
| showHelp | back to summary |
|---|---|
| pack-priv void showHelp(String launcher) | |
| showOption | back to summary |
|---|---|
| pack-priv void showOption(String option) | |
| showUsage | back to summary |
|---|---|
| pack-priv void showUsage(String launcher) | |
| showVersion | back to summary |
|---|---|
| pack-priv void showVersion(String launcher) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final SimpleFileServerImpl. | CMDERR
Not started, bad command-line arguments |
| public static final SimpleFileServerImpl. | OK
Started with no errors |
| public final int | |
| public static final SimpleFileServerImpl. | SYSERR
Not started, system error or resource exhaustion |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SimpleFileServerImpl. | |
| public static SimpleFileServerImpl. |
| CMDERR | back to summary |
|---|---|
| public static final SimpleFileServerImpl. Not started, bad command-line arguments | |
| OK | back to summary |
|---|---|
| public static final SimpleFileServerImpl. Started with no errors | |
| statusCode | back to summary |
|---|---|
| public final int statusCode | |
| SYSERR | back to summary |
|---|---|
| public static final SimpleFileServerImpl. Not started, system error or resource exhaustion | |
| Startup | back to summary |
|---|---|
| private Startup(int statusCode) | |
| valueOf | back to summary |
|---|---|
| public static SimpleFileServerImpl. | |
| values | back to summary |
|---|---|
| public static SimpleFileServerImpl. | |