001/* 002 * Copyright 2002-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.http.codec; 018 019import java.util.Map; 020 021import org.springframework.core.ResolvableType; 022import org.springframework.core.codec.Decoder; 023import org.springframework.http.server.reactive.ServerHttpRequest; 024import org.springframework.http.server.reactive.ServerHttpResponse; 025 026/** 027 * Extension of {@code Decoder} exposing extra methods relevant in the context 028 * of HTTP request or response body decoding. 029 * 030 * @author Rossen Stoyanchev 031 * @since 5.0 032 * @param <T> the type of elements in the output stream 033 */ 034public interface HttpMessageDecoder<T> extends Decoder<T> { 035 036 /** 037 * Get decoding hints based on the server request or annotations on the 038 * target controller method parameter. 039 * @param actualType the actual target type to decode to, possibly a reactive 040 * wrapper and sourced from {@link org.springframework.core.MethodParameter}, 041 * i.e. providing access to method parameter annotations 042 * @param elementType the element type within {@code Flux/Mono} that we're 043 * trying to decode to 044 * @param request the current request 045 * @param response the current response 046 * @return a Map with hints, possibly empty 047 */ 048 Map<String, Object> getDecodeHints(ResolvableType actualType, ResolvableType elementType, 049 ServerHttpRequest request, ServerHttpResponse response); 050 051}