jsr370-experts@jax-rs-spec.java.net

Registering the same provider class with Configurable

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 27 Apr 2015 11:10:07 +0100

Hi All,

The documentation at [1] says/shows the examples:

(1)

// register GzipInterceptor as a ReaderInterceptor
// as well as a WriterInterceptor
config.register(GzipInterceptor.class);

followed by

// override the priority of registered GzipInterceptor
// and both of it's provider contracts
config.register(GzipInterceptor.class, 6500);

Meaning that the previous GzipInterceptor registrations for its
contracts with some priority is replaced, with 6500 being a new priority.

(2)

And then "As a general rule, for each JAX-RS component class there can
be at most one registration..." with this example:

config.register(GzipInterceptor.class, WriterInterceptor.class);
...
config.register(GzipInterceptor.class, 6500); // Rejected by runtime.


So in (1) the second registration of GzipInterceptor is accepted, but in
(2) - no.

This is a bit confusing. What am I missing, can you please clarify ?

Thanks, Sergey



[1]
https://jax-rs-spec.java.net/nonav/2.0-rev-a/apidocs/javax/ws/rs/core/Configurable.html