-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance Quarkus support for Spring @RequestParam annotated parameters. #45233
Enhance Quarkus support for Spring @RequestParam annotated parameters. #45233
Conversation
Thanks for your pull request! Your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
57d15ac
to
0ee9c51
Compare
22e5638
to
88ef3ec
Compare
0810e13
to
2199afb
Compare
a860066
to
d09ef82
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d09ef82
to
2662b14
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2a06da6
to
0fd1911
Compare
This comment has been minimized.
This comment has been minimized.
0fd1911
to
9fcc868
Compare
This comment has been minimized.
This comment has been minimized.
9fcc868
to
f049005
Compare
This comment has been minimized.
This comment has been minimized.
f049005
to
69a1265
Compare
This comment has been minimized.
This comment has been minimized.
69a1265
to
0e1771a
Compare
This comment has been minimized.
This comment has been minimized.
0e1771a
to
5b3f121
Compare
This comment has been minimized.
This comment has been minimized.
@aureamunoz once you're done, it's probably a good idea to squash all your commits :) |
...e/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpRequest.java
Outdated
Show resolved
Hide resolved
Yes, of course |
7bea8ed
to
503084a
Compare
This comment has been minimized.
This comment has been minimized.
...java/io/quarkus/spring/web/resteasy/reactive/runtime/SpringMultiValueListParamExtractor.java
Outdated
Show resolved
Hide resolved
...on/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
Show resolved
Hide resolved
.../main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
Outdated
Show resolved
Hide resolved
503084a
to
1c63455
Compare
I refactored with your suggestions and squashed commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Status for workflow
|
Related to #43705
Several improvements have been implemented to enhance Quarkus support for Spring @RequestParam annotated parameters.
Support for Map and Multimap in RESTEasy
The
handleMapParam
method has been added to extract all URL parameters and store them in a JakartaMap
orMultimap
, depending on the user’s code definition.A new
ParameterConverter
(MapConverter
) has been introduced to transform received parameters into aMap
orMultimap
when theParameterHandler
detects that the endpoint expects this type of structure.The
ResteasyReactiveRequestContext.getQueryParameter
method has been modified to support these new data types.Retrieving parameters without knowing their names
A new
getParametersMap
method has been added to the API, allowing retrieval of all URL parameters without requiring prior knowledge of their names.This method integrates with
ParamExtractor
, which does not work directly with endpoint parameters but instead processes their characteristics (name, single/multi-value, encoding, etc.).Since
Map
andMultimap
cannot always be distinguished (both may contain multiple values per key), the method returns a unifiedMap<String, List<String>>
, allowingParamHandler
to process it consistently.Support for Spring’s MultiValueMap
A dedicated extractor,
SpringMultiValueMapParamExtractor
, has been created to read request parameters and store them in a SpringMultiValueMap<String, String>
.This was implemented using
MethodScannerBuildItem
, which detects methods with@RequestParam
annotations. If the parameter type isMultiValueMap<String, String>
, a specific extractor is instantiated to convert request parameters accordingly.As a result, users can now define methods in a Quarkus
@RestController
with aMultiValueMap<String, String>
parameter, and it will behave just like in Spring:Making @RequestParam required by default
In Spring, parameters annotated with
@RequestParam
are required by default unless explicitly marked as optional.MethodScannerBuildItem
is used to enforce this behavior, ensuring that parameters must have a value unless explicitly declared as optional.If a required parameter is missing,
SpringRequestParamHandler
handles the response by returning a 400 Bad Request error.Supporting multiple values in @RequestParam separated by comma
Spring allows
@RequestParam List<String>
to receive multiple values in a comma-separated format from the URL.To replicate this behavior, the
SpringMultiValueListParamExtractor
has been added, which automatically converts these values into aList<String>
.