use of org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl in project resteasy by resteasy.
the class ServerResponseWriter method executeFilters.
private static void executeFilters(BuiltResponse jaxrsResponse, HttpRequest request, HttpResponse response, ResteasyProviderFactory providerFactory, ResourceMethodInvoker method, Consumer<Throwable> onComplete, RunnableWithIOException continuation) throws IOException {
ContainerResponseFilter[] responseFilters = null;
if (method != null) {
responseFilters = method.getResponseFilters();
} else {
responseFilters = providerFactory.getContainerResponseFilterRegistry().postMatch(null, null);
}
if (responseFilters != null) {
ResponseContainerRequestContext requestContext = new ResponseContainerRequestContext(request);
ContainerResponseContextImpl responseContext = new ContainerResponseContextImpl(request, response, jaxrsResponse, requestContext, responseFilters, onComplete, continuation);
RESTEasyTracingLogger logger = RESTEasyTracingLogger.getInstance(request);
final long timestamp = logger.timestamp("RESPONSE_FILTER_SUMMARY");
// filter calls the continuation
responseContext.filter();
logger.logDuration("RESPONSE_FILTER_SUMMARY", timestamp, responseFilters.length);
} else {
try {
continuation.run(onComplete);
} catch (Throwable t) {
onComplete.accept(t);
SynchronousDispatcher.rethrow(t);
}
}
}
Aggregations