From b5cc80f43d78a4fef88a06449f218b30517fa117 Mon Sep 17 00:00:00 2001 From: ulrich Date: Tue, 23 Mar 2021 14:16:23 +0000 Subject: [PATCH] AbstractHandler hinzugefuegt --- src/de/uhilger/avdirektor/handler/CmdHandler.java | 29 +++-------------------------- 1 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/de/uhilger/avdirektor/handler/CmdHandler.java b/src/de/uhilger/avdirektor/handler/CmdHandler.java index 1ea0ec5..38f2b6f 100644 --- a/src/de/uhilger/avdirektor/handler/CmdHandler.java +++ b/src/de/uhilger/avdirektor/handler/CmdHandler.java @@ -1,10 +1,6 @@ package de.uhilger.avdirektor.handler; import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -12,37 +8,18 @@ * * @author ulrich */ -public class CmdHandler extends OMXPlayer implements HttpHandler { +public class CmdHandler extends AbstractHandler { private static final Logger logger = Logger.getLogger(CmdHandler.class.getName()); - - private String cmd; public CmdHandler(String cmd) { this.cmd = cmd; } - public void setCmd(String cmd) { - this.cmd = cmd; - } - - public String getCmd(String cmd) { - return this.cmd; - } - - @Override - public void handle(HttpExchange t) throws IOException { - logger.log(Level.FINE, "RequestURI: {0}", t.getRequestURI().toString()); - Map map = getQueryMap(t); - + protected String process(HttpExchange t, String params) { String antwort = this.kommando(cmd); logger.log(Level.FINE, antwort); - - String response = getResponseString(map, cmd, antwort); - t.sendResponseHeaders(200, response.length()); - OutputStream os = t.getResponseBody(); - os.write(response.getBytes()); - os.close(); + return antwort; } } -- Gitblit v1.9.3