@SuppressWarnings("JdkObsolete")
    public static Map<String, String> getRequestHeaders(final HttpServletRequest request) {
        val headers = new LinkedHashMap<String, Object>();
        if (request != null) {
            val headerNames = request.getHeaderNames();
            if (headerNames != null) {
                while (headerNames.hasMoreElements()) {
                    val headerName = headerNames.nextElement();
                    val headerValue = StringUtils.stripToEmpty(request.getHeader(headerName));
                    headers.put(headerName, headerValue);
                }
            }
        }
        return (Map) headers;
    }
Gets request headers.

@param request the request
@return the request headers
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/http/HttpRequestUtils.java