package de.uhilger.avdirektor.handler; 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; /** * * @author ulrich */ 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 { 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 ""; } }