From 8e2578a22a4cf2749d6d884e231335287069f490 Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 08 Apr 2021 17:14:35 +0000 Subject: [PATCH] Meldung nach Abspielliste Titel hinzufuegen --- src/de/uhilger/mediaz/api/ListHandler.java | 12 +----------- www/ui/js/app.js | 2 +- src/de/uhilger/mediaz/api/AbstractHandler.java | 4 ---- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/de/uhilger/mediaz/api/AbstractHandler.java b/src/de/uhilger/mediaz/api/AbstractHandler.java index 55d2ece..45befae 100644 --- a/src/de/uhilger/mediaz/api/AbstractHandler.java +++ b/src/de/uhilger/mediaz/api/AbstractHandler.java @@ -5,7 +5,6 @@ */ package de.uhilger.mediaz.api; -import com.google.gson.Gson; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import java.io.BufferedReader; @@ -13,7 +12,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import java.util.logging.Level; import java.util.logging.Logger; @@ -71,7 +69,6 @@ } break; } - logger.fine(response); e.sendResponseHeaders(code, response.length()); OutputStream os = e.getResponseBody(); os.write(response.getBytes()); @@ -89,7 +86,6 @@ } r.close(); String json = sb.toString(); - logger.log(Level.FINE, "json: {0}", json); return json; } diff --git a/src/de/uhilger/mediaz/api/ListHandler.java b/src/de/uhilger/mediaz/api/ListHandler.java index 84a9056..02cf740 100644 --- a/src/de/uhilger/mediaz/api/ListHandler.java +++ b/src/de/uhilger/mediaz/api/ListHandler.java @@ -49,10 +49,8 @@ String path = e.getRequestURI().toString(); String[] elems = path.split(App.getRs(Server.RB_SLASH)); String plname = elems[elems.length - 1]; - logger.finer("GET plname: " + plname); FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); String json = fs.readJson(FileStorage.ST_ABSPIELLISTE, plname); - logger.finer("PL json: " + json); return json; } @@ -61,12 +59,8 @@ String path = e.getRequestURI().toString(); String[] elems = path.split(App.getRs(Server.RB_SLASH)); String response = "ListHandler.put: ungueltiger URL"; - logger.finer("elems.length: " + elems.length); - for(String elem : elems) { - logger.finer("elem: " + elem); - } switch(elems.length) { - case 5: + case 5: // ohne nr am Ende response = addTitel(e, elems[4]); break; @@ -78,16 +72,12 @@ } private String addTitel(HttpExchange e, String plname) throws IOException { - //String plname = elems[elems.length - 1]; - logger.finer("plname: " + plname); FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); Entity entity = fs.read(FileStorage.ST_ABSPIELLISTE, plname); String response = "Titel konnte nicht hinzugefuegt werden."; if(entity instanceof Abspielliste) { Abspielliste aliste = (Abspielliste) entity; - logger.finer("aliste: " + aliste.getName()); String titelJson = bodyLesen(e); - logger.finer("titelJson: " + titelJson); Gson gson = new Gson(); Object o = gson.fromJson(titelJson, fs.typeFromName(Titel.class.getSimpleName()).getType()); if(o instanceof Titel) { diff --git a/www/ui/js/app.js b/www/ui/js/app.js index e9b7ce5..3f8f2b6 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -168,7 +168,7 @@ var titel = new Titel(self.mediaPfad + titelName, self.ortPfad); var plname = document.querySelector('#playlist').value; self.http_put('../api/alist/' + plname, JSON.stringify(titel), function(responseText) { - console.log(responseText); + self.meldung_mit_timeout(responseText, 1500); }); }; -- Gitblit v1.9.3