How to add more jax-rs components to the application?

382 views Asked by At

I want to add a @Provider ContainerRequestFilter to my web project which is already defined in another project on which my current project has dependency on. So, all the providers of that project are available to this project. Both wars are packaged as ear and deployed to wildfly. But since, context-roots are different for both the web projects (or both are different web applications), the @Provider is only working for the jax-rs resources in the first project.

So, I want to manually add the provider in the following way:

 public MyApplication extends Application{
    Set<..> getClasses(){
       //add provider here
    }
 }

If we leave that method empty, all the jax-rs resources are automatically registered. But we define that method, only the classes registered in that method are registered as resource classes. So, I want to add the provider keeping all the default loading of other resources without me having to add them in this method?

How to do that? or perhaps is there a way I can add some entry in web.xml of second project to use the ContainerRequestFilter from the first project? Can I add it under filter mapping?

0

There are 0 answers