Polishing

This commit is contained in:
Juergen Hoeller
2019-05-20 23:49:31 +02:00
parent 02fdf10c20
commit a41a5e195f
10 changed files with 61 additions and 74 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* 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.
@@ -139,7 +139,7 @@ public class MultipartHttpMessageWriter implements HttpMessageWriter<MultiValueM
* @since 5.0.7
*/
public List<HttpMessageWriter<?>> getPartWriters() {
return Collections.unmodifiableList(partWriters);
return Collections.unmodifiableList(this.partWriters);
}
/**
@@ -195,8 +195,8 @@ public class MultipartHttpMessageWriter implements HttpMessageWriter<MultiValueM
if (contentType != null) {
return MediaType.MULTIPART_FORM_DATA.includes(contentType);
}
for (String name : map.keySet()) {
for (Object value : map.get(name)) {
for (List<?> values : map.values()) {
for (Object value : values) {
if (value != null && !(value instanceof String)) {
return true;
}

View File

@@ -279,8 +279,8 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
if (contentType != null) {
return MediaType.MULTIPART_FORM_DATA.includes(contentType);
}
for (String name : map.keySet()) {
for (Object value : map.get(name)) {
for (List<?> values : map.values()) {
for (Object value : values) {
if (value != null && !(value instanceof String)) {
return true;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* 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.
@@ -48,6 +48,7 @@ import org.springframework.web.context.request.NativeWebRequest;
* @author Juergen Hoeller
* @author Rob Winch
* @since 3.2
* @param <T> the result type
*/
public class DeferredResult<T> {
@@ -57,7 +58,7 @@ public class DeferredResult<T> {
@Nullable
private final Long timeout;
private final Long timeoutValue;
private final Object timeoutResult;
@@ -82,25 +83,25 @@ public class DeferredResult<T> {
}
/**
* Create a DeferredResult with a timeout value.
* Create a DeferredResult with a custom timeout value.
* <p>By default not set in which case the default configured in the MVC
* Java Config or the MVC namespace is used, or if that's not set, then the
* timeout depends on the default of the underlying server.
* @param timeout timeout value in milliseconds
* @param timeoutValue timeout value in milliseconds
*/
public DeferredResult(Long timeout) {
this(timeout, RESULT_NONE);
public DeferredResult(Long timeoutValue) {
this(timeoutValue, RESULT_NONE);
}
/**
* Create a DeferredResult with a timeout value and a default result to use
* in case of timeout.
* @param timeout timeout value in milliseconds (ignored if {@code null})
* @param timeoutValue timeout value in milliseconds (ignored if {@code null})
* @param timeoutResult the result to use
*/
public DeferredResult(@Nullable Long timeout, Object timeoutResult) {
public DeferredResult(@Nullable Long timeoutValue, Object timeoutResult) {
this.timeoutResult = timeoutResult;
this.timeout = timeout;
this.timeoutValue = timeoutValue;
}
@@ -141,7 +142,7 @@ public class DeferredResult<T> {
*/
@Nullable
final Long getTimeoutValue() {
return this.timeout;
return this.timeoutValue;
}
/**