protected void postEncode(final MessageContext messageContext, final String endpointURL) throws MessageEncodingException {
        LOGGER.debug("Invoking Velocity template to create POST body");

        try {
            val velocityContext = new VelocityContext();
            this.populateVelocityContext(velocityContext, messageContext, endpointURL);

            responseAdapter.setContentType("text/html");
            responseAdapter.init();

            val out = responseAdapter.getOutputStreamWriter();
            this.getVelocityEngine().mergeTemplate(this.getVelocityTemplateId(), "UTF-8", velocityContext, out);
            out.flush();
        } catch (final Exception e) {
            throw new MessageEncodingException("Error creating output document", e);
        }
    }
<p>postEncode.</p>

@param messageContext a {@link MessageContext} object
@param endpointURL a {@link String} object
@throws MessageEncodingException if any.
pac4j-saml/src/main/java/org/pac4j/saml/transport/Pac4jHTTPPostEncoder.java