App zur Steuerung des mpv Mediaplayers auf einem Raspberry Pi über HTTP
undisclosed
2023-01-08 e27ab178fa3a2f967823c1bfc81951086e15b642
src/de/uhilger/calypso/http/ApiHandler.java
File was renamed from src/de/uhilger/calypso/neu/http/ApiHandler.java
@@ -16,14 +16,15 @@
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
package de.uhilger.calypso.neu.http;
package de.uhilger.calypso.http;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpExchange;
import de.uhilger.calypso.neu.actor.PlayActor;
import de.uhilger.calypso.neu.actor.ShellActor;
import de.uhilger.calypso.neu.actor.StopServerActor;
import de.uhilger.calypso.actor.PlayActor;
import de.uhilger.calypso.actor.ShellActor;
import de.uhilger.calypso.actor.StopServerActor;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import java.util.logging.Level;
@@ -109,8 +110,14 @@
        
      case SERVER:
        if(elems[SERVERCMD].equals(STOP)) {
          new StopServerActor().run(exchange.getHttpContext());
          antwort = "Calypso: Der Server wird angehalten und die App beendet.";
          try {
            antwort = "Calypso: Der Server wird angehalten und die App beendet.";
            sendResponse(exchange, antwort);
            new StopServerActor().run(exchange.getHttpContext());
          } catch (IOException ex) {
            Logger.getLogger(ApiHandler.class.getName()).log(Level.SEVERE, null, ex);
            antwort = "Fehler: " + ex.getLocalizedMessage();
          }
        } else {
          antwort = elems[SERVERCMD] + " ist ein unbekanntes Serverkommando";
        }