You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue with handling collection type @QueryParam in my JAX-RS application. I'm using ParamConverterProvider to convert query parameters to custom Java types. However, I'm having trouble when the request includes multiple keys for the same parameter.
When I call the endpoint with multiple keys like this:
/api?name=Bob&name=James
Only the first parameter (Bob) gets converted. However, it works fine when I use a single key with comma-separated values:
/api?name=Bob,James
Here's a brief overview of my setup:
I'm using ParamConverterProvider to provide ParamConverter instances for custom types.
I've created a CollectionParameterConverter to handle collections of these types.
The conversion works as expected for comma-separated values but not for multiple keys.
How can I properly handle a collection type @QueryParam when the request includes multiple keys for the same parameter? Any guidance or examples on how to adapt the ParamConverterProvider or other relevant parts of the code would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone,
I'm facing an issue with handling collection type
@QueryParam
in my JAX-RS application. I'm usingParamConverterProvider
to convert query parameters to custom Java types. However, I'm having trouble when the request includes multiple keys for the same parameter.When I call the endpoint with multiple keys like this:
Only the first parameter (
Bob
) gets converted. However, it works fine when I use a single key with comma-separated values:Here's a brief overview of my setup:
ParamConverterProvider
to provideParamConverter
instances for custom types.CollectionParameterConverter
to handle collections of these types.How can I properly handle a collection type
@QueryParam
when the request includes multiple keys for the same parameter? Any guidance or examples on how to adapt theParamConverterProvider
or other relevant parts of the code would be greatly appreciated.Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions