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