mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-25 18:54:36 +01:00
Initial Commit
This commit is contained in:
22
src/main/java/emu/nebula/server/routes/HttpJsonResponse.java
Normal file
22
src/main/java/emu/nebula/server/routes/HttpJsonResponse.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package emu.nebula.server.routes;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import io.javalin.http.ContentType;
|
||||
import io.javalin.http.Context;
|
||||
import io.javalin.http.Handler;
|
||||
|
||||
public class HttpJsonResponse implements Handler {
|
||||
private final String json;
|
||||
|
||||
public HttpJsonResponse(String jsonString) {
|
||||
this.json = jsonString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(@NotNull Context ctx) throws Exception {
|
||||
ctx.status(200);
|
||||
ctx.contentType(ContentType.APPLICATION_JSON);
|
||||
ctx.result(json);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user