Ingesting form data into a bean without annotations #35351
Unanswered
lhgravendeel
asked this question in
Q&A
Replies: 1 comment
-
\cc @maxandersen not sure which label would match here |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for a way to ingest regular posted form data into a simple java class with no annotations on it.
The incoming request is sending HTTP POST data (
Content-Type: application/x-www-form-urlencoded
):If the receiving class did have annotations, it would look like this with quarkus-resteasy-reactive and Quarkus 3.2.3:
The receiving method then works like this:
Up to this part, it all works fine, but I'm trying to figure out how to make this work with a class similar to DummyForm - without annotations. For example, I would like to ingest this form data as this
PlainDummyForm
:If I try this out with a controller method, Quarkus will return a status code 415 (Unsupported Media Type) :
I also tried out
public String formTestResult(@BeanParam PlainDummyForm dummyForm)
, but this triggers an exception:Caused by: jakarta.enterprise.inject.spi.DeploymentException: No annotations found on fields at 'nl.gravendeeldesign.studio.forms.DummyForm'. Annotations like `@QueryParam` should be used in fields, not in methods
Just for comparison - if I were sending JSON data rather than form data, the approach with
PlainDummyForm
and no annotations seems to work well if I'm using quarkus-resteasy-reactive-jackson.Is there any way to make the approach with
PlainDummyForm
and no annotations work for form data as well?Beta Was this translation helpful? Give feedback.
All reactions