All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.predic8.membrane.core.interceptor.oauth2client.rf.FormPostGenerator Maven / Gradle / Ivy

There is a newer version: 5.7.3
Show newest version
package com.predic8.membrane.core.interceptor.oauth2client.rf;

import com.predic8.membrane.core.http.Response;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

import static com.predic8.membrane.core.http.MimeType.TEXT_HTML_UTF8;
import static org.apache.commons.text.StringEscapeUtils.escapeXml11;

public class FormPostGenerator {

    private final String url;
    private final Map parameters = new HashMap<>();

    public FormPostGenerator(String url) {
        this.url = url;
    }

    public Response build() {
        return Response.ok().contentType(TEXT_HTML_UTF8).body(
                "Submit This Form"
                        + "
" + parameters.entrySet().stream().map(e -> "").collect(Collectors.joining()) + "
").build(); } public FormPostGenerator withParameter(String key, String value) { parameters.put(key, value); return this; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy