How to use the same ContainerRequestFilter for multiple projects?

646 views Asked by At

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

1

There are 1 answers

0
pinkpanther On

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.