From 4b060908721d58a551aa4b20f60c86030ed7d782 Mon Sep 17 00:00:00 2001 From: Josiah Noel <32279667+SentryMan@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:45:45 -0500 Subject: [PATCH] Update JexAdapter.java --- .../main/java/io/avaje/http/generator/jex/JexAdapter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http-generator-jex/src/main/java/io/avaje/http/generator/jex/JexAdapter.java b/http-generator-jex/src/main/java/io/avaje/http/generator/jex/JexAdapter.java index 3ed2e3df..730fd52f 100644 --- a/http-generator-jex/src/main/java/io/avaje/http/generator/jex/JexAdapter.java +++ b/http-generator-jex/src/main/java/io/avaje/http/generator/jex/JexAdapter.java @@ -7,6 +7,7 @@ import io.avaje.http.generator.core.ControllerReader; import io.avaje.http.generator.core.ParamType; import io.avaje.http.generator.core.PlatformAdapter; +import io.avaje.http.generator.core.ProcessingContext; import io.avaje.http.generator.core.UType; class JexAdapter implements PlatformAdapter { @@ -32,13 +33,14 @@ public boolean isBodyMethodParam() { public String bodyAsClass(UType type) { if ("java.io.InputStream".equals(type.full())) { - return "ctx.bodyInputStream()"; + return "ctx.bodyAsInputStream()"; } else if ("java.lang.String".equals(type.full())) { return "ctx.body()"; } else if ("byte[]".equals(type.full())) { return "ctx.bodyAsBytes()"; + } else if (ProcessingContext.useJsonb()) { + return type.shortName() + "JsonType.fromJson(ctx.bodyAsInputStream())"; } - return "ctx.bodyAsClass(" + type.mainType() + ".class)"; }