Example usage for org.springframework.http HttpMessage getHeaders

List of usage examples for org.springframework.http HttpMessage getHeaders

Introduction

In this page you can find the example usage for org.springframework.http HttpMessage getHeaders.

Prototype

HttpHeaders getHeaders();

Source Link

Document

Return the headers of this message.

Usage

From source file:com.kite9.k9server.LoggingInterceptor.java

private static Charset getCharset(HttpMessage message) {
    return Optional.ofNullable(message.getHeaders().getContentType()).map(MediaType::getCharset)
            .orElse(DEFAULT_CHARSET);// ww  w.  ja  v  a2s.c  o  m
}

From source file:org.springframework.http.codec.DecoderHttpMessageReader.java

/**
 * Determine the Content-Type of the HTTP message based on the
 * "Content-Type" header or otherwise default to
 * {@link MediaType#APPLICATION_OCTET_STREAM}.
 * @param inputMessage the HTTP message//from  w  w w .  j  a v  a 2  s.  c o  m
 * @return the MediaType, possibly {@code null}.
 */
@Nullable
protected MediaType getContentType(HttpMessage inputMessage) {
    MediaType contentType = inputMessage.getHeaders().getContentType();
    return (contentType != null ? contentType : MediaType.APPLICATION_OCTET_STREAM);
}

From source file:org.springframework.http.codec.multipart.DefaultMultipartMessageReader.java

@Nullable
private static byte[] boundary(HttpMessage message) {
    MediaType contentType = message.getHeaders().getContentType();
    if (contentType != null) {
        String boundary = contentType.getParameter("boundary");
        if (boundary != null) {
            return boundary.getBytes(StandardCharsets.ISO_8859_1);
        }//from w w  w  .j a  v a2  s  .  c  o m
    }
    return null;
}