From 16b4427e669cef85e5f575d945f865310f2011c8 Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 24 Mar 2021 23:28:33 +0000 Subject: [PATCH] FileHandler angepasst --- src/de/uhilger/avdirektor/handler/FileHandler.java | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/de/uhilger/avdirektor/handler/FileHandler.java b/src/de/uhilger/avdirektor/handler/FileHandler.java index 1583694..6158cf5 100644 --- a/src/de/uhilger/avdirektor/handler/FileHandler.java +++ b/src/de/uhilger/avdirektor/handler/FileHandler.java @@ -2,7 +2,6 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; -import de.uhilger.avdirektor.App; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -19,7 +18,7 @@ private static final Logger logger = Logger.getLogger(FileHandler.class.getName()); - private String basePath; + private final String basePath; public FileHandler(String basePath) { this.basePath = basePath; @@ -34,10 +33,10 @@ fName += "index.html"; } OutputStream os = t.getResponseBody(); - File outFile = new File(basePath, fName); - if(outFile.exists()) { - t.sendResponseHeaders(200, outFile.length()); - InputStream in = new FileInputStream(outFile); + File file = new File(basePath, fName); + if(file.exists()) { + t.sendResponseHeaders(200, file.length()); + InputStream in = new FileInputStream(file); int b = in.read(); while(b > -1) { os.write(b); -- Gitblit v1.9.3