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

org.mapfish.print.http.Utils Maven / Gradle / Ivy

There is a newer version: 3.22.0
Show newest version
package org.mapfish.print.http;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
 * Network utils classe.
 */
public final class Utils {
    private Utils() {
    }

    private static final List AUTH_HEADERS = Arrays.asList(
        new String[]{"cookie", "set-cookie", "authorization"}
    );

    /**
     * Get a list of printable (auth header will be hidden) headers 'header=value'.
     *
     * @param headers The headers
     */
    public static List getPrintableHeadersList(final Map> headers) {
        final List result = new ArrayList();
        for (String header: headers.keySet()) {
            List value = headers.get(header);
            if (AUTH_HEADERS.contains(header.toLowerCase())) {
                value = Arrays.asList(new String[]{"***"});
            }
            result.add(String.format("%s: %s", header, String.join(", ", value)));
        }
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy