public static String buildFormPostContent(final WebContext context) {
        val requestedUrl = context.getFullRequestURL();
        val parameters = context.getRequestParameters();
        val buffer = new StringBuilder();
        buffer.append("<html>\n");
        buffer.append("<body>\n");
        buffer.append("<form action=\"" + escapeHtml4(requestedUrl) + "\" name=\"f\" method=\"post\">\n");
        if (parameters != null) {
            for (val entry : parameters.entrySet()) {
                val values = entry.getValue();
                if (values != null && values.length > 0) {
                    buffer.append("<input type='hidden' name=\"" + escapeHtml4(entry.getKey())
                        + "\" value=\"" + escapeHtml4(values[0]) + "\" />\n");
                }
            }
        }
        buffer.append("<input value='POST' type='submit' />\n");
        buffer.append("</form>\n");
        buffer.append("<script type='text/javascript'>document.forms['f'].submit();</script>\n");
        buffer.append("</body>\n");
        buffer.append("</html>\n");
        return buffer.toString();
    }
Build a form POST content from the web context.

@param context the web context
@return the form POST content
pac4j-core/src/main/java/org/pac4j/core/util/HttpActionHelper.java