This commit is contained in:
anthorob committed 2021-09-21 13:43:11 -04:00
1 parent 7291ffc0a1
commit 62fe015ffa
2 files changed
+20 -13

No files matched your search

+2 -2
View File
@@ -67,9 +67,9 @@
</build> </build>
<repositories> <repositories>
<repository> <!-- This repo fixes issues with transitive dependencies --> <repository>
<id>central</id> <id>central</id>
<url>https://repo1.maven.org/maven2/</url> <url>https://repo.maven.apache.org/maven2</url>
</repository> </repository>
<repository> <repository>
@@ -15,21 +15,28 @@ import java.io.OutputStream;
public class ActionHandler implements HttpHandler { public class ActionHandler implements HttpHandler {
@Override @Override
public void handle(HttpExchange exchange) throws IOException { public void handle(HttpExchange exchange) {
String path = exchange.getRequestURI().getRawPath();
if (path.equals("/actions/shutdown")) { try {
LogManager.getLogger().info("Request to shutdown received"); String path = exchange.getRequestURI().getRawPath();
exchange.sendResponseHeaders(200, "Shutting down..".length());
if (path.equals("/actions/shutdown")) {
LogManager.getLogger().info("Request to shutdown received");
exchange.sendResponseHeaders(200, "Shutting down..".length());
OutputStream os = exchange.getResponseBody();
os.write("Shutting down..".getBytes());
os.close();
//MusicBot.shutdown();
return;
}
exchange.sendResponseHeaders(200, path.length());
OutputStream os = exchange.getResponseBody(); OutputStream os = exchange.getResponseBody();
os.write("Shutting down..".getBytes()); os.write(path.getBytes());
os.close(); os.close();
MusicBot.shutdown(); } catch (Exception ex) {
ex.printStackTrace();
} }
exchange.sendResponseHeaders(200, path.length());
OutputStream os = exchange.getResponseBody();
os.write(path.getBytes());
os.close();
} }
} }