From 914030841f2f12df6923fb5c52172a32bdc252e2 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Fri, 14 Apr 2023 01:36:32 +0200 Subject: [PATCH] Enable JSON output. --- pom.xml | 2 +- .../ch/fritteli/labyrinth/server/OutputType.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 85f10f6..e267284 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 17 24.0.1 5.9.2 - 0.0.5 + 0.0.6 1.4.6 1.18.26 2.0.7 diff --git a/src/main/java/ch/fritteli/labyrinth/server/OutputType.java b/src/main/java/ch/fritteli/labyrinth/server/OutputType.java index c1d08d9..77fd88b 100644 --- a/src/main/java/ch/fritteli/labyrinth/server/OutputType.java +++ b/src/main/java/ch/fritteli/labyrinth/server/OutputType.java @@ -2,6 +2,7 @@ package ch.fritteli.labyrinth.server; import ch.fritteli.labyrinth.generator.model.Labyrinth; import ch.fritteli.labyrinth.generator.renderer.html.HTMLRenderer; +import ch.fritteli.labyrinth.generator.renderer.json.JsonRenderer; import ch.fritteli.labyrinth.generator.renderer.pdf.PDFRenderer; import ch.fritteli.labyrinth.generator.renderer.text.TextRenderer; import ch.fritteli.labyrinth.generator.serialization.SerializerDeserializer; @@ -28,6 +29,18 @@ public enum OutputType { false, "h", "html"), + JSON("application/json", + "json", + labyrinth -> JsonRenderer.newInstance().render(labyrinth).getBytes(StandardCharsets.UTF_8), + false, + "j", + "json"), + JSONFILE("application/json", + "json", + labyrinth -> JsonRenderer.newInstance().render(labyrinth).getBytes(StandardCharsets.UTF_8), + true, + "s", + "jsonfile"), PDF("application/pdf", "pdf", labyrinth -> PDFRenderer.newInstance().render(labyrinth).toByteArray(), -- 2.45.2