Example usage for org.springframework.http.codec HttpMessageEncoder getEncodeHints

List of usage examples for org.springframework.http.codec HttpMessageEncoder getEncodeHints

Introduction

In this page you can find the example usage for org.springframework.http.codec HttpMessageEncoder getEncodeHints.

Prototype

default Map<String, Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType,
        @Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) 

Source Link

Document

Get decoding hints based on the server request or annotations on the target controller method parameter.

Usage

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

/**
 * Get additional hints for encoding for example based on the server request
 * or annotations from controller method parameters. By default, delegate to
 * the encoder if it is an instance of {@link HttpMessageEncoder}.
 */// w  w  w.  j  av a 2 s . co m
protected Map<String, Object> getWriteHints(ResolvableType streamType, ResolvableType elementType,
        @Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {

    if (this.encoder instanceof HttpMessageEncoder) {
        HttpMessageEncoder<?> encoder = (HttpMessageEncoder<?>) this.encoder;
        return encoder.getEncodeHints(streamType, elementType, mediaType, request, response);
    }
    return Hints.none();
}