| | |
| | | |
| | | import com.sun.net.httpserver.HttpContext; |
| | | import com.sun.net.httpserver.HttpExchange; |
| | | import de.uhilger.calypso.actor.DownServerActor; |
| | | import de.uhilger.calypso.actor.PlayActor; |
| | | import de.uhilger.calypso.actor.ShellActor; |
| | | import de.uhilger.calypso.actor.StopServerActor; |
| | |
| | | public static final String STOP = "stop"; |
| | | public static final String SERVER = "server"; |
| | | public static final String PING = "ping"; |
| | | public static final String DOWN = "down"; |
| | | |
| | | public static final String PLAYER = "player-proc"; |
| | | |
| | |
| | | break; |
| | | |
| | | case SERVER: |
| | | if(elems[SERVERCMD].equals(STOP)) { |
| | | switch (elems[SERVERCMD]) { |
| | | case STOP: |
| | | try { |
| | | antwort = "Calypso: Der Server wird angehalten und die App beendet."; |
| | | sendResponse(exchange, antwort); |
| | |
| | | Logger.getLogger(ApiHandler.class.getName()).log(Level.SEVERE, null, ex); |
| | | antwort = "Fehler: " + ex.getLocalizedMessage(); |
| | | } |
| | | } else { |
| | | break; |
| | | case DOWN: |
| | | try { |
| | | antwort = "Calypso: Der Server wird angehalten, die App beendet und die Maschine ausgeschaltet."; |
| | | sendResponse(exchange, antwort); |
| | | new DownServerActor().run(exchange.getHttpContext()); |
| | | } catch (IOException ex) { |
| | | Logger.getLogger(ApiHandler.class.getName()).log(Level.SEVERE, null, ex); |
| | | antwort = "Fehler: " + ex.getLocalizedMessage(); |
| | | } |
| | | break; |
| | | default: |
| | | antwort = elems[SERVERCMD] + " ist ein unbekanntes Serverkommando"; |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | | |
| | | |
| | | case PING: |
| | | antwort = elems[PLAYERCMD]; |