Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1786

DynamicFeature should warn user when registering wrong provider type


      According to the java doc of javax.ws.rs.container.DynamicFeature#configure(ResourceInfo resourceInfo, FeatureContext context), DynamicFeature can be used to register at least one of the following provider types:


      And also additional ones based on the implementation choice.

      The registered provider instances or classes are expected to be implementing one or more of the following interfaces: 
      A provider instance or class that does not implement any of the interfaces above may be ignored by the JAX-RS implementation. In such case a warning message must be logged. JAX-RS implementations may support additional provider contracts that can be registered using a dynamic feature concept. 

      It seem's that Resteasy also allows to register following provider types in addition to the ones listed above such as:


      The problem is that thoses providers registered in a DynamicFeatures will never be used since they are registered on a child instance totally separate from the parent ResteasyProviderFactory instance (see ResourceMethodInvoker constructor) which is the one used to find registered providers :

       this.resourceMethodProviderFactory = new ResteasyProviderFactory(providerFactory);
            for (DynamicFeature feature : providerFactory.getServerDynamicFeatures())
               feature.configure(resourceInfo, new FeatureContextDelegate(resourceMethodProviderFactory));

      So I suggest not to let those unusable providers being registred in a DynamicFeature and instead add a warn log in order to inform user of the rejected registration.

            rhn-support-asoldano Alessio Soldano
            nicones Nicolas NESMON (Inactive)
            0 Vote for this issue
            2 Start watching this issue