Must be given an absolute pathname to the directory to be served. Supports only HEAD and GET requests. Directory listings and files can be served, content types are supported on a best-guess basis.
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private final System. | |
| private static final HttpHandler | |
| private final UnaryOperator | |
| private static final HttpHandler | |
| private static final String | |
| private static final Map | |
| private final Path | |
| private static final UnaryOperator | |
| private static final List | |
| private static final List |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static Path | |
| private static void | |
| private static String | |
| public static HttpHandler | |
| private static String | |
| private static void | |
| private static String | |
| private String | |
| public void | handle(HttpExchange exchange)
Implements com. Handle the given request and generate an appropriate response. |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private static String | |
| private static Path | |
| private static boolean | |
| private static boolean | |
| private void | |
| private Path | |
| private String | |
| private static boolean | |
| private static String | |
| private static String | |
| private void | |
| private void |
| closeHTML | back to summary |
|---|---|
| private static final String closeHTML | |
| DEFAULT_CONTENT_TYPE | back to summary |
|---|---|
| private static final String DEFAULT_CONTENT_TYPE | |
| FAVICON_LAST_MODIFIED | back to summary |
|---|---|
| private static final String FAVICON_LAST_MODIFIED | |
| FAVICON_RESOURCE_PATH | back to summary |
|---|---|
| private static final String FAVICON_RESOURCE_PATH | |
| hrefListItemTemplate | back to summary |
|---|---|
| private static final String hrefListItemTemplate | |
| logger | back to summary |
|---|---|
| private final System. | |
| METHOD_NOT_ALLOWED_HANDLER | back to summary |
|---|---|
| private static final HttpHandler METHOD_NOT_ALLOWED_HANDLER | |
| mimeTable | back to summary |
|---|---|
| private final UnaryOperator<String> mimeTable | |
| NOT_IMPLEMENTED_HANDLER | back to summary |
|---|---|
| private static final HttpHandler NOT_IMPLEMENTED_HANDLER | |
| openHTML | back to summary |
|---|---|
| private static final String openHTML | |
| RESERVED_CHARS | back to summary |
|---|---|
| private static final Map<Integer, String> RESERVED_CHARS | |
| root | back to summary |
|---|---|
| private final Path root | |
| sanitize | back to summary |
|---|---|
| private static final UnaryOperator<String> sanitize | |
| SUPPORTED_METHODS | back to summary |
|---|---|
| private static final List<String> SUPPORTED_METHODS | |
| UNSUPPORTED_METHODS | back to summary |
|---|---|
| private static final List<String> UNSUPPORTED_METHODS | |
| FileServerHandler | back to summary |
|---|---|
| private FileServerHandler(Path root, UnaryOperator<String> mimeTable) | |
| checkPathWithinRoot | back to summary |
|---|---|
| private static Path checkPathWithinRoot(Path path, Path root) | |
| checkRequestWithinContext | back to summary |
|---|---|
| private static void checkRequestWithinContext(String requestPath, String contextPath) | |
| contextPath | back to summary |
|---|---|
| private static String contextPath(HttpExchange exchange) | |
| create | back to summary |
|---|---|
| public static HttpHandler create(Path root, UnaryOperator<String> mimeTable) | |
| dirListing | back to summary |
|---|---|
| private static String dirListing(HttpExchange exchange, Path path) throws IOException | |
| discardRequestBody | back to summary |
|---|---|
| private static void discardRequestBody(HttpExchange exchange) throws IOException | |
| getLastModified | back to summary |
|---|---|
| private static String getLastModified(Path path) throws IOException | |
| getRedirectURI | back to summary |
|---|---|
| private String getRedirectURI(URI uri) | |
| handle | back to summary |
|---|---|
| public void handle(HttpExchange exchange) throws IOException Implements com. Doc from com. Handle the given request and generate an appropriate response.
See
| |
| handleGET | back to summary |
|---|---|
| private void handleGET(HttpExchange exchange, Path path) throws IOException | |
| handleHEAD | back to summary |
|---|---|
| private void handleHEAD(HttpExchange exchange, Path path) throws IOException | |
| handleMovedPermanently | back to summary |
|---|---|
| private void handleMovedPermanently(HttpExchange exchange) throws IOException | |
| handleNotFound | back to summary |
|---|---|
| private void handleNotFound(HttpExchange exchange) throws IOException | |
| handleSupportedMethod | back to summary |
|---|---|
| private void handleSupportedMethod(HttpExchange exchange, Path path, boolean writeBody) throws IOException | |
| hrefListItemFor | back to summary |
|---|---|
| private static String hrefListItemFor(URI uri) | |
| indexFile | back to summary |
|---|---|
| private static Path indexFile(Path path) | |
| isFavIconRequest | back to summary |
|---|---|
| private static boolean isFavIconRequest(HttpExchange exchange) | |
| isHiddenOrSymLink | back to summary |
|---|---|
| private static boolean isHiddenOrSymLink(Path path) | |
| listFiles | back to summary |
|---|---|
| private void listFiles(HttpExchange exchange, Path path, boolean writeBody) throws IOException | |
| mapToPath | back to summary |
|---|---|
| private Path mapToPath(HttpExchange exchange, Path root) | |
| mediaType | back to summary |
|---|---|
| private String mediaType(String file) | |
| pathEndsWithSlash | back to summary |
|---|---|
| private static boolean pathEndsWithSlash(HttpExchange exchange) | |
| relativeRequestPath | back to summary |
|---|---|
| private static String relativeRequestPath(HttpExchange exchange) | |
| requestPath | back to summary |
|---|---|
| private static String requestPath(HttpExchange exchange) | |
| serveDefaultFavIcon | back to summary |
|---|---|
| private void serveDefaultFavIcon(HttpExchange exchange, boolean writeBody) throws IOException | |
| serveFile | back to summary |
|---|---|
| private void serveFile(HttpExchange exchange, Path path, boolean writeBody) throws IOException | |