From d64c87fd1796c343894338aba279c3aa672428dc Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 20 Nov 2024 12:28:22 +0000 Subject: [PATCH] Dokumentation in Arbeit: Anpassung an FileEraser, FileList umbenannt --- /dev/null | 61 ------------------------------ src/de/uhilger/neon/fm/FileEraser.java | 2 2 files changed, 1 insertions(+), 62 deletions(-) diff --git a/src/de/uhilger/neon/fm/FileEraser.java b/src/de/uhilger/neon/fm/FileEraser.java index 4de6588..92e441d 100644 --- a/src/de/uhilger/neon/fm/FileEraser.java +++ b/src/de/uhilger/neon/fm/FileEraser.java @@ -48,7 +48,7 @@ * Das Loeschen geschieht rekursiv, einschliesslich aller Unterordner * </pre> * - * @param exchange Das Objekt mit Infos zu HTTP-Request, -Response usw. + * @param exchange das Objekt mit Infos zu HTTP-Request, -Response usw. */ public void delete(HttpExchange exchange) { try { diff --git a/src/de/uhilger/neon/fm/FileList.java b/src/de/uhilger/neon/fm/FileList.java deleted file mode 100644 index 2e6348e..0000000 --- a/src/de/uhilger/neon/fm/FileList.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - neon-fm - Dateiverwaltung fuer neon - Copyright (C) 2024 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.neon.fm; - -import com.sun.net.httpserver.HttpContext; -import com.sun.net.httpserver.HttpExchange; -import de.uhilger.neon.FileServer; -import de.uhilger.neon.HttpHelper; -import de.uhilger.neon.HttpResponder; -import de.uhilger.fm.Catalog; -import java.io.IOException; - -/** - * - * @author Ulrich Hilger - * @version 0.1, 05.11.2024 - */ -public class FileList extends AbstractFileActor { - - public void run(HttpExchange exchange) { - try { - init(exchange); - HttpContext ctx = exchange.getHttpContext(); - String base = ctx.getAttributes().getOrDefault(FileServer.ATTR_FILE_BASE, "").toString(); - if(base.length() == 0) { - new HttpResponder().sendNotFound(exchange, exchange.getRequestURI().toString()); // not found - } else { - String fName = new HttpHelper().getFileName(exchange); - if (fName.endsWith(FileServer.STR_SLASH)) { // Ordnerliste erzeugen - String json = new Catalog().list(fName, ctx.getPath(), base); - if (null != json) { - new HttpResponder().antwortSenden(exchange, HttpResponder.SC_OK, json); - } else { - new HttpResponder().antwortSenden(exchange, HttpResponder.SC_OK, "{}"); // leere Liste - } - } else { - new FileServer().serveFile(exchange); // Datei ausliefern - } - } - } catch (IOException | IllegalArgumentException ex) { - fehlerAntwort(exchange, ex); - } finally { - free(); - } - } -} \ No newline at end of file -- Gitblit v1.9.3