users@jersey.java.net

[Jersey] Re: Parameter converter order from Jersey 1.x to Jersey 2.x

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Wed, 24 Jun 2015 16:33:54 -0700

You are right that JAX-RS 2.0 introduced the ParamConverterProvider/ParamConverter concept.

I’m surprised that you have hard time finding JAX-RS spec material. When I google for “JAX-RS spec”, this is the first page I get:
https://jax-rs-spec.java.net/ <https://jax-rs-spec.java.net/>
That page contains links to all relevant JAX-RS spec material in all released versions.

Marek

> On 17 Jun 2015, at 07:30, Behrooz Nobakht <nobeh5_at_gmail.com> wrote:
>
> Hi,
>
> I have tried to dig documentation of JAX-RS 1.0 and JAX-RS 2.0 to
> be able to analyze and compare, however, no luck.
>
> Our situation is the following:
>
> - We upgrade from Jersey 1.x to Jersey 2.x in a large code base.
> - Some of the REST resources on Jersey 1.x used Java enum types as query parameters.
> - We had customized enum message body reader/writer in Jersey 1.x.
> - We also upgraded the above to Jersey 2.x compat.
>
> I would like to confirm the following regarding Jersey 1.x and Jersey 2.x:
>
> - In Jersey 1.x, there was no difference between ParamConverterProvider and MessageBodyReaderWriter.
> In other words, you could use either to provide the necessary parameters into the resources method parameters.
> - In Jersey 2.x, because of compatibility with JAX-RS 2.0, there is an explicit difference between
> ParamConverterProvider and MessageBodyReaderWriter. In other words, one should explicit and specific
> implementations for params and response/request body although the implementations might be similar.
>
> Our observation was that our enum string values started to be rejected as of the upgrade to Jersey 2.x.
> The issue was the our custom enum serializers were not picked up for parameter conversion and that's
> why Jersey's internal param converter for enum values rejected lower case strings for enums.
>
> The only way I could explain this was the above theory about the difference of ParamCoverterProvider
> and MessageBodyReaderWriters from Jersey 1.x to Jersey 2.x.
> Is this correct?
>
> Thanks,
> Behrooz
>