Polishing

This commit is contained in:
Juergen Hoeller
2020-08-07 13:02:43 +02:00
parent 94eee6a32a
commit 8dd285f877
13 changed files with 68 additions and 61 deletions

View File

@@ -49,7 +49,6 @@ import org.springframework.util.StringUtils;
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.1.1">
* HTTP 1.1: Semantics and Content, section 3.1.1.1</a>
*/
@SuppressWarnings("deprecation")
public class MediaType extends MimeType implements Serializable {
private static final long serialVersionUID = 2069937152339670231L;
@@ -647,7 +646,7 @@ public class MediaType extends MimeType implements Serializable {
*/
public static List<MediaType> asMediaTypes(List<MimeType> mimeTypes) {
List<MediaType> mediaTypes = new ArrayList<>(mimeTypes.size());
for(MimeType mimeType : mimeTypes) {
for (MimeType mimeType : mimeTypes) {
mediaTypes.add(MediaType.asMediaType(mimeType));
}
return mediaTypes;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 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.
@@ -64,7 +64,7 @@ public class WebExchangeDataBinder extends WebDataBinder {
/**
* Bind query params, form data, and or multipart form data to the binder target.
* @param exchange the current exchange.
* @param exchange the current exchange
* @return a {@code Mono<Void>} when binding is complete
*/
public Mono<Void> bind(ServerWebExchange exchange) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@@ -109,12 +109,12 @@ public class WebRequestDataBinder extends WebDataBinder {
*/
public void bind(WebRequest request) {
MutablePropertyValues mpvs = new MutablePropertyValues(request.getParameterMap());
if (isMultipartRequest(request) && request instanceof NativeWebRequest) {
if (request instanceof NativeWebRequest) {
MultipartRequest multipartRequest = ((NativeWebRequest) request).getNativeRequest(MultipartRequest.class);
if (multipartRequest != null) {
bindMultipart(multipartRequest.getMultiFileMap(), mpvs);
}
else {
else if (isMultipartRequest(request)) {
HttpServletRequest servletRequest = ((NativeWebRequest) request).getNativeRequest(HttpServletRequest.class);
if (servletRequest != null) {
bindParts(servletRequest, mpvs);
@@ -130,7 +130,7 @@ public class WebRequestDataBinder extends WebDataBinder {
*/
private boolean isMultipartRequest(WebRequest request) {
String contentType = request.getHeader("Content-Type");
return StringUtils.startsWithIgnoreCase(contentType, "multipart");
return StringUtils.startsWithIgnoreCase(contentType, "multipart/");
}
private void bindParts(HttpServletRequest request, MutablePropertyValues mpvs) {