From 438c31692792fcd4045eb6c437eac1a086713460 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 22 Apr 2021 15:39:33 +0000
Subject: [PATCH] Option -b des omxplayer entfernt

---
 src/de/uhilger/avdirektor/handler/LogHandler.java |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/de/uhilger/avdirektor/handler/LogHandler.java b/src/de/uhilger/avdirektor/handler/LogHandler.java
index 8d49d27..02c67ed 100644
--- a/src/de/uhilger/avdirektor/handler/LogHandler.java
+++ b/src/de/uhilger/avdirektor/handler/LogHandler.java
@@ -3,7 +3,10 @@
 import com.sun.net.httpserver.HttpExchange;
 import de.uhilger.avdirektor.OMXLogLeser;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.text.ParseException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -14,17 +17,39 @@
 public class LogHandler extends AbstractHandler {
   
   private static final Logger logger = Logger.getLogger(LogHandler.class.getName());
+  
+  @Override
+  public void handle(HttpExchange t) throws IOException {
+    logger.log(Level.FINE, "RequestURI: {0}", t.getRequestURI().toString());
+    StringBuilder params = buildParams(t);
+    String antwort = process(t, params.toString());
+    sendResponse(t, cmd, antwort);
+  }
+  
+  @Override
+  protected void sendResponse(HttpExchange t, String cmd, String antwort) throws IOException {
+    t.sendResponseHeaders(200, antwort.length());
+    OutputStream os = t.getResponseBody();
+    os.write(antwort.getBytes());
+    os.close();    
+  }
+  
 
   @Override
   protected String process(HttpExchange t, String params) {
+    /*
     OMXLogLeser leser = new OMXLogLeser();
     String lines = "Log nicht lesbar.";
     try {
-      lines = leser.lesen(new File("/home/ulrich/work/avd/omxplayer.log"));
+      logger.info(new File(".").getAbsolutePath());
+      lines = leser.lesen(new File("omxplayer.log"));
     } catch (IOException ex) {
       Logger.getLogger(LogHandler.class.getName()).log(Level.SEVERE, null, ex);
+    } catch (ParseException ex) {
+      Logger.getLogger(LogHandler.class.getName()).log(Level.SEVERE, null, ex);
     }
-    return lines;
+    */
+    return "";
   }
   
 }

--
Gitblit v1.9.3