chain.doFilter(request, wrapper);
Document<Element> doc = getDocument(wrapper);
if (doc != null) {
Encryption enc = security.getEncryption();
EncryptionOptions options = initEncryptionOptions(request,response,enc,arg);
Document<Element> enc_doc = enc.encrypt(doc, options);
enc_doc.writeTo(response.getOutputStream());
}
} else {
chain.doFilter(request, response);
}