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

org.seekay.contract.model.tools.HeaderTools Maven / Gradle / Ivy

The newest version!
package org.seekay.contract.model.tools;


import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

public class HeaderTools {

    /**
     * Private constructor for utility class
     */
    private HeaderTools() {
        throw new IllegalStateException("Utility classes should never be constructed");
    }

    public static Map extractHeaders(HttpServletRequest request) {
        Map result = new HashMap();
        Enumeration headerNames = request.getHeaderNames();
        while(headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            result.put(headerName, request.getHeader(headerName));
        }
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy