Polishing
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user