In wildfly 8.1 with REST services, I wanted to implement CORS ContainerRequestFilter and ContainerResponseFilter.
My request filter is working properly but Con
You are mixing ContainerRequestFilter
and ContainerResponseFilter
in your question. As you want to send additional Headers to the client the ContainerResponseFilter
is the right one.
The @PreMatching annotation can be applied to a ContainerRequestFilter
"to indicate that such filter should be applied globally on all resources in the application before the actual resource matching occurs".
Adding it to a ContainerResponseFilter
does not make sense. Just remove the annotation and your filter should work.