From 095119ef9193968d088911688d18e03abc6d3b3a Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 11 Apr 2021 11:51:58 +0000
Subject: [PATCH] Fehler bei Abspielliste-Formular bei Cancel behoben, Abspielliste leeren, UI-Erweiterungen fuer Auswahl aus Katalog

---
 src/de/uhilger/mediaz/api/ListFileHandler.java |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/de/uhilger/mediaz/api/ListFileHandler.java b/src/de/uhilger/mediaz/api/ListFileHandler.java
index 4c31548..864e45b 100644
--- a/src/de/uhilger/mediaz/api/ListFileHandler.java
+++ b/src/de/uhilger/mediaz/api/ListFileHandler.java
@@ -17,6 +17,7 @@
  */
 package de.uhilger.mediaz.api;
 
+import com.sun.net.httpserver.Headers;
 import com.sun.net.httpserver.HttpExchange;
 import de.uhilger.mediaz.App;
 import de.uhilger.mediaz.Server;
@@ -30,6 +31,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Level;
@@ -79,6 +82,7 @@
       File dir = new File(fileBase, fName);
       logger.fine(dir.getAbsolutePath());
       File[] files = dir.listFiles();
+      Arrays.sort(files);      
       ArrayList list = new ArrayList();
       if(files != null) {
         for(File file : files) {
@@ -103,8 +107,11 @@
           list.add(sf);
         }
       }
+      //Collections.sort(list);
       String json = jsonWithCustomType(list, "Medialiste");
       logger.fine(json);
+      Headers headers = e.getResponseHeaders();
+      headers.add("Content-Type", "application/json");
       e.sendResponseHeaders(200, json.length());
       OutputStream os = e.getResponseBody();
       os.write(json.getBytes());

--
Gitblit v1.9.3