/*
 * Copyright 2002-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.http.codec;

import java.util.Map;

import org.springframework.core.ResolvableType;
import org.springframework.core.codec.Hints;
import org.springframework.core.codec.ResourceDecoder;
import org.springframework.core.io.Resource;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.util.StringUtils;

/**
 * Simple around around {@link ResourceDecoder} that extracts the filename from
 * the "Content-Disposition" header, if available, and passes it as the hint
 * {@link ResourceDecoder#FILENAME_HINT}.
 *
 * @author Rossen Stoyanchev
 * @since 5.2
 */
public class ResourceHttpMessageReader extends DecoderHttpMessageReader<Resource> {


	public ResourceHttpMessageReader() {
		super(new ResourceDecoder());
	}

	public ResourceHttpMessageReader(ResourceDecoder resourceDecoder) {
		super(resourceDecoder);
	}


	@Override
	protected Map<String, Object> getReadHints(ResolvableType actualType, ResolvableType elementType,
			ServerHttpRequest request, ServerHttpResponse response) {

		String name = request.getHeaders().getContentDisposition().getFilename();
		return StringUtils.hasText(name) ? Hints.from(ResourceDecoder.FILENAME_HINT, name) : Hints.none();
	}

}

@@ -247,17 +247,16 @@
     http
-s
 ://www.a
@@ -614,16 +614,17 @@
 se.%0A */%0A
+%0A
 package 
@@ -1064,28 +1064,63 @@
 %0A * 
-Simple around around
+%7B@code HttpMessageReader%7D that wraps and delegates to a
  %7B@l
@@ -1135,24 +1135,27 @@
 urceDecoder%7D
+%0A *
  that extrac
@@ -1178,16 +1178,20 @@
 from
-%0A *
  the 
+%7B@code 
 %22Con
@@ -1207,16 +1207,17 @@
 osition%22
+%7D
  header,
@@ -1219,16 +1219,19 @@
 ader, if
+%0A *
  availab
@@ -1258,16 +1258,8 @@
  the
- hint%0A *
  %7B@l
@@ -1429,17 +1429,16 @@
 rce%3E %7B%0A%0A
-%0A
 %09public 

Fix Checkstyle error and polish Javadoc for ResourceHttpMessageReader