简体   繁体   中英

How to use the same ContainerRequestFilter for multiple projects?

I have two projects A and B in which B has dependency on A. So all the classes of A are available to B.

Now, I've defined a ContainerRequestFilter for intercepting some information from request. This is getting invoked if I call the end points of project A. But it's not getting invoked if I call end points of project B.

Obviously, the context roots of project A and project B are different.

Example: http://localhost:8080/projecta/ ..... http://localhost:8080/projectb/ .....

Both the projects are archived in an ear and deployed in same ear.

I actually expected it to work like in the case of @AroundInvoke interceptor.

How to achieve that?

Wildfly 8.0 Resteasy Java EE 7

I've added the providers in the web.xml of the second project and it did the work.

    <context-param>
        <param-name>resteasy.providers</param-name>
        <param-value>com.example.SampleRequestFilter,com.example.SampleResponseFilter</param-value>
    </context-param>

For the first project, it's not required. Some how jax-rs is loading the provider. For the second project, I added the above param and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM