dvelopp dvelopp - 5 days ago 8
reST (reStructuredText) Question

@ModelAttribute for Jersey similar to Spring

I wonder whether jersey has something like Spring MVC can offer to pass several query parameters inside a one. When we need to group several params in Spring MVC, we can use

@ModelAttribute
and have these query params in URL listed as
?name=SomeName&city=SomeCity
... Then we just create a POJO that contains these fields. Does jersey have similar functionality? Using a json is unacceptable for my case cause I'm modifying an old API.

Thanks!

Answer

You could do that with @BeanParam starting with JAX-RS 2.0. See a sample here.

Comments