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

梦想与她 提交于 2019-12-11 20:40:56

问题


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?

来源:https://stackoverflow.com/questions/30739380/how-to-add-more-jax-rs-components-to-the-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!