From c18e1dfdb92661fcb8d2eaff87517ec5232f0f46 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 23 Apr 2021 17:53:30 +0000
Subject: [PATCH] Abspielprozess wird nicht mehr auf null gesetzt
---
src/de/uhilger/avdirektor/handler/FileHandler.java | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/de/uhilger/avdirektor/handler/FileHandler.java b/src/de/uhilger/avdirektor/handler/FileHandler.java
index 1583694..7721d97 100644
--- a/src/de/uhilger/avdirektor/handler/FileHandler.java
+++ b/src/de/uhilger/avdirektor/handler/FileHandler.java
@@ -1,8 +1,25 @@
+/*
+ AV-Direktor - Control OMXPlayer on Raspberry Pi via HTTP
+ Copyright (C) 2021 Ulrich Hilger
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+
package de.uhilger.avdirektor.handler;
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 +36,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 +51,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