@Override
public StreamSinkConduit wrap(final ConduitFactory<StreamSinkConduit> factory, final HttpServerExchange exchange) {
if(!responseCache.isResponseCachable()) {
return factory.create();
}
final AllowedContentEncodings contentEncodings = exchange.getAttachment(AllowedContentEncodings.ATTACHMENT_KEY);
if(contentEncodings != null) {
if(!contentEncodings.isIdentity()) {
//we can't cache content encoded responses, as we have no idea how big they will end up being
return factory.create();
}
}
String lengthString = exchange.getResponseHeaders().getFirst(CONTENT_LENGTH);