users@jersey.java.net

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

From: Behrooz Nobakht <nobeh5_at_gmail.com>
Date: Wed, 17 Jun 2015 16:30:32 +0200

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