Skip to content

Commit 7a473a7

Browse files
committed
Made file handler classes extendable
1 parent c844a6b commit 7a473a7

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/main/java/dev/latvian/apps/tinyserver/http/file/DynamicFileHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.nio.file.Path;
1111

1212
public record DynamicFileHandler<REQ extends HTTPRequest>(Path directory, FileResponseHandler responseHandler, boolean autoIndex) implements HTTPHandler<REQ> {
13+
1314
@Override
1415
public HTTPResponse handle(REQ req) throws IOException {
1516
var pathVar = req.variables().get("path");

src/main/java/dev/latvian/apps/tinyserver/http/file/FileIndexHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.nio.file.Path;
1212

1313
public record FileIndexHandler<REQ extends HTTPRequest>(Path rootDirectory, Path directory, FileResponseHandler responseHandler) implements HTTPHandler<REQ> {
14+
1415
@Override
1516
public HTTPResponse handle(REQ req) throws IOException {
1617
if (Files.exists(directory) && Files.isReadable(directory) && Files.isDirectory(directory)) {

src/main/java/dev/latvian/apps/tinyserver/http/file/SingleFileHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.nio.file.Path;
1010

1111
public record SingleFileHandler<REQ extends HTTPRequest>(Path path, String contentType, FileResponseHandler responseHandler) implements HTTPHandler<REQ> {
12+
1213
@Override
1314
public HTTPResponse handle(REQ req) {
1415
if (Files.exists(path) && Files.isReadable(path) && Files.isRegularFile(path)) {

0 commit comments

Comments
 (0)