AsyncHandler<?> handler, //
HttpResponseStatus status,//
HttpResponseHeaders responseHeaders) throws IOException {
if (hasResponseFilters) {
FilterContext fc = new FilterContext.FilterContextBuilder().asyncHandler(handler).request(future.getRequest())
.responseStatus(status).responseHeaders(responseHeaders).build();
for (ResponseFilter asyncFilter : config.getResponseFilters()) {
try {
fc = asyncFilter.filter(fc);
// FIXME Is it worth protecting against this?
if (fc == null) {
throw new NullPointerException("FilterContext is null");
}
} catch (FilterException efe) {
requestSender.abort(channel, future, efe);
}
}
// The handler may have been wrapped.
future.setAsyncHandler(fc.getAsyncHandler());
// The request has changed
if (fc.replayRequest()) {
requestSender.replayRequest(future, fc, channel);
return true;
}
}
return false;