Search in sources :

Example 1 with ContainerResponseContextImpl

use of org.apache.cxf.jaxrs.impl.ContainerResponseContextImpl in project cxf by apache.

the class JAXRSUtils method runContainerResponseFilters.

public static void runContainerResponseFilters(ServerProviderFactory pf, ResponseImpl r, Message m, OperationResourceInfo ori, Method invoked) throws IOException, Throwable {
    List<ProviderInfo<ContainerResponseFilter>> containerFilters = pf.getContainerResponseFilters(ori == null ? null : ori.getNameBindings());
    if (!containerFilters.isEmpty()) {
        ContainerRequestContext requestContext = new ContainerRequestContextImpl(m.getExchange().getInMessage(), false, true);
        ContainerResponseContext responseContext = new ContainerResponseContextImpl(r, m, ori == null ? null : ori.getClassResourceInfo().getServiceClass(), invoked);
        for (ProviderInfo<ContainerResponseFilter> filter : containerFilters) {
            InjectionUtils.injectContexts(filter.getProvider(), filter, m);
            filter.getProvider().filter(requestContext, responseContext);
        }
    }
}
Also used : ContainerResponseFilter(javax.ws.rs.container.ContainerResponseFilter) ProviderInfo(org.apache.cxf.jaxrs.model.ProviderInfo) ContainerRequestContext(javax.ws.rs.container.ContainerRequestContext) ContainerRequestContextImpl(org.apache.cxf.jaxrs.impl.ContainerRequestContextImpl) ContainerResponseContext(javax.ws.rs.container.ContainerResponseContext) ContainerResponseContextImpl(org.apache.cxf.jaxrs.impl.ContainerResponseContextImpl)

Aggregations

ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)1 ContainerResponseContext (javax.ws.rs.container.ContainerResponseContext)1 ContainerResponseFilter (javax.ws.rs.container.ContainerResponseFilter)1 ContainerRequestContextImpl (org.apache.cxf.jaxrs.impl.ContainerRequestContextImpl)1 ContainerResponseContextImpl (org.apache.cxf.jaxrs.impl.ContainerResponseContextImpl)1 ProviderInfo (org.apache.cxf.jaxrs.model.ProviderInfo)1