Example usage for javax.servlet.http HttpServletResponse getHeaderNames

List of usage examples for javax.servlet.http HttpServletResponse getHeaderNames

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse getHeaderNames.

Prototype

public Collection<String> getHeaderNames();

Source Link

Document

Gets the names of the headers of this response.

Usage

From source file:org.kurento.repository.internal.http.RepositoryHttpServlet.java

private void logResponse(HttpServletResponse resp) {

    Collection<String> headerNames = resp.getHeaderNames();
    for (String headerName : headerNames) {
        Collection<String> values = resp.getHeaders(headerName);
        log.debug("  Header {}: {}", headerName, values);
    }//from   w w  w  .j  a  v a  2s.co  m
}

From source file:org.mobile.mpos.interceptor.LoggerInterceptor.java

/**
 * ???//  w ww.java  2 s  .c om
 * @param response
 */
private void printHeaders(HttpServletResponse response) {
    if (response != null) {
        StringBuilder head = new StringBuilder();
        head.append(SystemUtils.LINE_SEPARATOR);
        head.append("heads:");
        head.append(SystemUtils.LINE_SEPARATOR);
        JSONObject h = new JSONObject();
        for (String headerName : response.getHeaderNames()) {
            h.put(headerName, response.getHeader(headerName));
        }
        head.append(h.toString(4));
        logger.info(head.toString());
    }
}

From source file:org.springframework.boot.actuate.trace.WebRequestTraceFilter.java

private Map<String, String> getResponseHeaders(HttpServletResponse response) {
    Map<String, String> headers = new LinkedHashMap<String, String>();
    for (String header : response.getHeaderNames()) {
        String value = response.getHeader(header);
        headers.put(header, value);// w w w .ja va 2s .  com
    }
    headers.put("status", "" + response.getStatus());
    return headers;
}

From source file:org.xlcloud.xsa.meter.ApiCallMeteringFilter.java

private static Map<String, String> getHeadersMap(HttpServletResponse response) {
    Map<String, String> map = new HashMap<String, String>();
    for (String header : response.getHeaderNames()) {
        map.put(header, response.getHeader(header));
    }//from  w  ww  .ja  va2s . c  o m
    return map;
}