Browse Source

Polishing (backported from 5.2.x)

pull/23967/head
Juergen Hoeller 6 years ago
parent
commit
bfd20da9de
  1. 21
      spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
  2. 6
      spring-context/src/main/java/org/springframework/cache/support/AbstractValueAdaptingCache.java
  3. 4
      spring-core/src/main/java/org/springframework/core/io/FileUrlResource.java
  4. 14
      spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java
  5. 11
      spring-web/src/main/java/org/springframework/http/MediaType.java
  6. 4
      spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeDataBinder.java
  7. 12
      spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java
  8. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolver.java
  9. 17
      spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
  10. 51
      spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java
  11. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/CookieLocaleResolver.java

21
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

@ -94,8 +94,7 @@ import org.springframework.util.StringUtils; @@ -94,8 +94,7 @@ import org.springframework.util.StringUtils;
* operating on pre-resolved bean definition metadata objects.
*
* <p>Note that readers for specific bean definition formats are typically
* implemented separately rather than as bean factory subclasses:
* see for example {@link PropertiesBeanDefinitionReader} and
* implemented separately rather than as bean factory subclasses: see for example
* {@link org.springframework.beans.factory.xml.XmlBeanDefinitionReader}.
*
* <p>For an alternative implementation of the
@ -182,7 +181,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -182,7 +181,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
private volatile String[] frozenBeanDefinitionNames;
/** Whether bean definition metadata may be cached for all beans. */
private volatile boolean configurationFrozen = false;
private volatile boolean configurationFrozen;
/**
@ -354,12 +353,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -354,12 +353,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
@Override
public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType) throws BeansException {
public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType) {
Assert.notNull(requiredType, "Required type must not be null");
return getBeanProvider(ResolvableType.forRawClass(requiredType));
}
@SuppressWarnings("unchecked")
@Override
public <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType) {
return new BeanObjectProvider<T>() {
@ -389,15 +387,20 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -389,15 +387,20 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
public T getIfUnique() throws BeansException {
return resolveBean(requiredType, null, true);
}
@SuppressWarnings("unchecked")
@Override
public Stream<T> stream() {
return Arrays.stream(getBeanNamesForTypedStream(requiredType))
.map(name -> (T) getBean(name))
.filter(bean -> !(bean instanceof NullBean));
}
@SuppressWarnings("unchecked")
@Override
public Stream<T> orderedStream() {
String[] beanNames = getBeanNamesForTypedStream(requiredType);
if (beanNames.length == 0) {
return Stream.empty();
}
Map<String, T> matchingBeans = new LinkedHashMap<>(beanNames.length);
for (String beanName : beanNames) {
Object beanInstance = getBean(beanName);
@ -1352,9 +1355,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -1352,9 +1355,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
Object result = converter.convertIfNecessary(matchingBeans.values(), type);
if (result instanceof List) {
Comparator<Object> comparator = adaptDependencyComparator(matchingBeans);
if (comparator != null) {
((List<?>) result).sort(comparator);
if (((List<?>) result).size() > 1) {
Comparator<Object> comparator = adaptDependencyComparator(matchingBeans);
if (comparator != null) {
((List<?>) result).sort(comparator);
}
}
}
return result;

6
spring-context/src/main/java/org/springframework/cache/support/AbstractValueAdaptingCache.java vendored

@ -1,5 +1,5 @@ @@ -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.
@ -55,8 +55,7 @@ public abstract class AbstractValueAdaptingCache implements Cache { @@ -55,8 +55,7 @@ public abstract class AbstractValueAdaptingCache implements Cache {
@Override
@Nullable
public ValueWrapper get(Object key) {
Object value = lookup(key);
return toValueWrapper(value);
return toValueWrapper(lookup(key));
}
@Override
@ -123,5 +122,4 @@ public abstract class AbstractValueAdaptingCache implements Cache { @@ -123,5 +122,4 @@ public abstract class AbstractValueAdaptingCache implements Cache {
return (storeValue != null ? new SimpleValueWrapper(fromStoreValue(storeValue)) : null);
}
}

4
spring-core/src/main/java/org/springframework/core/io/FileUrlResource.java

@ -1,5 +1,5 @@ @@ -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.
@ -52,7 +52,7 @@ public class FileUrlResource extends UrlResource implements WritableResource { @@ -52,7 +52,7 @@ public class FileUrlResource extends UrlResource implements WritableResource {
/**
* Create a new {@code FileUrlResource} based on the given URL object.
* <p>Note that this does not enforce "file" as URL protocol. If a protocol
* is known to be resolvable to a file,
* is known to be resolvable to a file, it is acceptable for this purpose.
* @param url a URL
* @see ResourceUtils#isFileURL(URL)
* @see #getFile()

14
spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java

@ -1,5 +1,5 @@ @@ -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.
@ -146,7 +146,8 @@ public class PersistenceExceptionTranslationInterceptor @@ -146,7 +146,8 @@ public class PersistenceExceptionTranslationInterceptor
else {
PersistenceExceptionTranslator translator = this.persistenceExceptionTranslator;
if (translator == null) {
Assert.state(this.beanFactory != null, "No PersistenceExceptionTranslator set");
Assert.state(this.beanFactory != null,
"Cannot use PersistenceExceptionTranslator autodetection without ListableBeanFactory");
translator = detectPersistenceExceptionTranslators(this.beanFactory);
this.persistenceExceptionTranslator = translator;
}
@ -157,16 +158,15 @@ public class PersistenceExceptionTranslationInterceptor @@ -157,16 +158,15 @@ public class PersistenceExceptionTranslationInterceptor
/**
* Detect all PersistenceExceptionTranslators in the given BeanFactory.
* @param beanFactory the ListableBeanFactory to obtaining all
* PersistenceExceptionTranslators from
* @param bf the ListableBeanFactory to obtain PersistenceExceptionTranslators from
* @return a chained PersistenceExceptionTranslator, combining all
* PersistenceExceptionTranslators found in the factory
* PersistenceExceptionTranslators found in the given bean factory
* @see ChainedPersistenceExceptionTranslator
*/
protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(ListableBeanFactory beanFactory) {
protected PersistenceExceptionTranslator detectPersistenceExceptionTranslators(ListableBeanFactory bf) {
// Find all translators, being careful not to activate FactoryBeans.
Map<String, PersistenceExceptionTranslator> pets = BeanFactoryUtils.beansOfTypeIncludingAncestors(
beanFactory, PersistenceExceptionTranslator.class, false, false);
bf, PersistenceExceptionTranslator.class, false, false);
ChainedPersistenceExceptionTranslator cpet = new ChainedPersistenceExceptionTranslator();
for (PersistenceExceptionTranslator pet : pets.values()) {
cpet.addDelegate(pet);

11
spring-web/src/main/java/org/springframework/http/MediaType.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -85,7 +85,6 @@ public class MediaType extends MimeType implements Serializable { @@ -85,7 +85,6 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code application/json}.
* @see #APPLICATION_JSON_UTF8
*/
public static final MediaType APPLICATION_JSON;
@ -97,7 +96,6 @@ public class MediaType extends MimeType implements Serializable { @@ -97,7 +96,6 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code application/json;charset=UTF-8}.
*
* <p>This {@link MediaType#APPLICATION_JSON} variant should be used to set JSON
* content type because while
* <a href="https://tools.ietf.org/html/rfc7159#section-11">RFC7159</a>
@ -108,7 +106,6 @@ public class MediaType extends MimeType implements Serializable { @@ -108,7 +106,6 @@ public class MediaType extends MimeType implements Serializable {
/**
* A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
*
* <p>This {@link MediaType#APPLICATION_JSON_VALUE} variant should be used to set JSON
* content type because while
* <a href="https://tools.ietf.org/html/rfc7159#section-11">RFC7159</a>
@ -407,7 +404,7 @@ public class MediaType extends MimeType implements Serializable { @@ -407,7 +404,7 @@ public class MediaType extends MimeType implements Serializable {
/**
* Copy-constructor that copies the type and subtype of the given {@code MediaType},
* and allows for different parameter.
* and allows for different parameters.
* @param other the other media type
* @param parameters the parameters, may be {@code null}
* @throws IllegalArgumentException if any of the parameters contain illegal characters
@ -454,7 +451,7 @@ public class MediaType extends MimeType implements Serializable { @@ -454,7 +451,7 @@ public class MediaType extends MimeType implements Serializable {
* <p>For instance, {@code text/*} includes {@code text/plain} and {@code text/html},
* and {@code application/*+xml} includes {@code application/soap+xml}, etc.
* This method is <b>not</b> symmetric.
* <p>Simply calls {@link #includes(MimeType)} but declared with a
* <p>Simply calls {@link MimeType#includes(MimeType)} but declared with a
* {@code MediaType} parameter for binary backwards compatibility.
* @param other the reference media type with which to compare
* @return {@code true} if this media type includes the given media type;
@ -469,7 +466,7 @@ public class MediaType extends MimeType implements Serializable { @@ -469,7 +466,7 @@ public class MediaType extends MimeType implements Serializable {
* <p>For instance, {@code text/*} is compatible with {@code text/plain},
* {@code text/html}, and vice versa. In effect, this method is similar to
* {@link #includes}, except that it <b>is</b> symmetric.
* <p>Simply calls {@link #isCompatibleWith(MimeType)} but declared with a
* <p>Simply calls {@link MimeType#isCompatibleWith(MimeType)} but declared with a
* {@code MediaType} parameter for binary backwards compatibility.
* @param other the reference media type with which to compare
* @return {@code true} if this media type is compatible with the given media type;

4
spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeDataBinder.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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) {

12
spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java

@ -1,5 +1,5 @@ @@ -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.
@ -101,7 +101,7 @@ public class WebRequestDataBinder extends WebDataBinder { @@ -101,7 +101,7 @@ public class WebRequestDataBinder extends WebDataBinder {
* <p>The type of the target property for a multipart file can be Part, MultipartFile,
* byte[], or String. The latter two receive the contents of the uploaded file;
* all metadata like original file name, content type, etc are lost in those cases.
* @param request request with parameters to bind (can be multipart)
* @param request the request with parameters to bind (can be multipart)
* @see org.springframework.web.multipart.MultipartRequest
* @see org.springframework.web.multipart.MultipartFile
* @see javax.servlet.http.Part
@ -109,12 +109,12 @@ public class WebRequestDataBinder extends WebDataBinder { @@ -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);
@ -126,11 +126,11 @@ public class WebRequestDataBinder extends WebDataBinder { @@ -126,11 +126,11 @@ public class WebRequestDataBinder extends WebDataBinder {
/**
* Check if the request is a multipart request (by checking its Content-Type header).
* @param request request with parameters to bind
* @param request the request with parameters to bind
*/
private boolean isMultipartRequest(WebRequest request) {
String contentType = request.getHeader("Content-Type");
return (contentType != null && StringUtils.startsWithIgnoreCase(contentType, "multipart"));
return StringUtils.startsWithIgnoreCase(contentType, "multipart/");
}
private void bindParts(HttpServletRequest request, MutablePropertyValues mpvs) {

4
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolver.java

@ -1,5 +1,5 @@ @@ -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.
@ -85,7 +85,6 @@ public class PathVariableMethodArgumentResolver extends AbstractNamedValueSyncAr @@ -85,7 +85,6 @@ public class PathVariableMethodArgumentResolver extends AbstractNamedValueSyncAr
}
@Override
@SuppressWarnings("unchecked")
protected Object resolveNamedValue(String name, MethodParameter parameter, ServerWebExchange exchange) {
String attributeName = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
return exchange.getAttributeOrDefault(attributeName, Collections.emptyMap()).get(name);
@ -97,7 +96,6 @@ public class PathVariableMethodArgumentResolver extends AbstractNamedValueSyncAr @@ -97,7 +96,6 @@ public class PathVariableMethodArgumentResolver extends AbstractNamedValueSyncAr
}
@Override
@SuppressWarnings("unchecked")
protected void handleResolvedValue(
@Nullable Object arg, String name, MethodParameter parameter, Model model, ServerWebExchange exchange) {

17
spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java

@ -1,5 +1,5 @@ @@ -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.
@ -88,10 +88,16 @@ public class HandlerExecutionChain { @@ -88,10 +88,16 @@ public class HandlerExecutionChain {
return this.handler;
}
/**
* Add the given interceptor to the end of this chain.
*/
public void addInterceptor(HandlerInterceptor interceptor) {
initInterceptorList().add(interceptor);
}
/**
* Add the given interceptors to the end of this chain.
*/
public void addInterceptors(HandlerInterceptor... interceptors) {
if (!ObjectUtils.isEmpty(interceptors)) {
CollectionUtils.mergeArrayIntoCollection(interceptors, initInterceptorList());
@ -188,13 +194,16 @@ public class HandlerExecutionChain { @@ -188,13 +194,16 @@ public class HandlerExecutionChain {
HandlerInterceptor[] interceptors = getInterceptors();
if (!ObjectUtils.isEmpty(interceptors)) {
for (int i = interceptors.length - 1; i >= 0; i--) {
if (interceptors[i] instanceof AsyncHandlerInterceptor) {
HandlerInterceptor interceptor = interceptors[i];
if (interceptor instanceof AsyncHandlerInterceptor) {
try {
AsyncHandlerInterceptor asyncInterceptor = (AsyncHandlerInterceptor) interceptors[i];
AsyncHandlerInterceptor asyncInterceptor = (AsyncHandlerInterceptor) interceptor;
asyncInterceptor.afterConcurrentHandlingStarted(request, response, this.handler);
}
catch (Throwable ex) {
logger.error("Interceptor [" + interceptors[i] + "] failed in afterConcurrentHandlingStarted", ex);
if (logger.isErrorEnabled()) {
logger.error("Interceptor [" + interceptor + "] failed in afterConcurrentHandlingStarted", ex);
}
}
}
}

51
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -310,22 +310,22 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -310,22 +310,22 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
}
/**
* Detect beans of type {@link MappedInterceptor} and add them to the list of mapped interceptors.
* <p>This is called in addition to any {@link MappedInterceptor MappedInterceptors} that may have been provided
* via {@link #setInterceptors}, by default adding all beans of type {@link MappedInterceptor}
* from the current context and its ancestors. Subclasses can override and refine this policy.
* @param mappedInterceptors an empty list to add {@link MappedInterceptor} instances to
* Detect beans of type {@link MappedInterceptor} and add them to the list
* of mapped interceptors.
* <p>This is called in addition to any {@link MappedInterceptor}s that may
* have been provided via {@link #setInterceptors}, by default adding all
* beans of type {@link MappedInterceptor} from the current context and its
* ancestors. Subclasses can override and refine this policy.
* @param mappedInterceptors an empty list to add to
*/
protected void detectMappedInterceptors(List<HandlerInterceptor> mappedInterceptors) {
mappedInterceptors.addAll(
BeanFactoryUtils.beansOfTypeIncludingAncestors(
obtainApplicationContext(), MappedInterceptor.class, true, false).values());
mappedInterceptors.addAll(BeanFactoryUtils.beansOfTypeIncludingAncestors(
obtainApplicationContext(), MappedInterceptor.class, true, false).values());
}
/**
* Initialize the specified interceptors, checking for {@link MappedInterceptor MappedInterceptors} and
* adapting {@link HandlerInterceptor}s and {@link WebRequestInterceptor HandlerInterceptor}s and
* {@link WebRequestInterceptor}s if necessary.
* Initialize the specified interceptors adapting
* {@link WebRequestInterceptor}s to {@link HandlerInterceptor}.
* @see #setInterceptors
* @see #adaptInterceptor
*/
@ -342,13 +342,13 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -342,13 +342,13 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
}
/**
* Adapt the given interceptor object to the {@link HandlerInterceptor} interface.
* <p>By default, the supported interceptor types are {@link HandlerInterceptor}
* and {@link WebRequestInterceptor}. Each given {@link WebRequestInterceptor}
* will be wrapped in a {@link WebRequestHandlerInterceptorAdapter}.
* Can be overridden in subclasses.
* @param interceptor the specified interceptor object
* @return the interceptor wrapped as HandlerInterceptor
* Adapt the given interceptor object to {@link HandlerInterceptor}.
* <p>By default, the supported interceptor types are
* {@link HandlerInterceptor} and {@link WebRequestInterceptor}. Each given
* {@link WebRequestInterceptor} is wrapped with
* {@link WebRequestHandlerInterceptorAdapter}.
* @param interceptor the interceptor
* @return the interceptor downcast or adapted to HandlerInterceptor
* @see org.springframework.web.servlet.HandlerInterceptor
* @see org.springframework.web.context.request.WebRequestInterceptor
* @see WebRequestHandlerInterceptorAdapter
@ -367,7 +367,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -367,7 +367,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
/**
* Return the adapted interceptors as {@link HandlerInterceptor} array.
* @return the array of {@link HandlerInterceptor HandlerInterceptors}, or {@code null} if none
* @return the array of {@link HandlerInterceptor HandlerInterceptor}s,
* or {@code null} if none
*/
@Nullable
protected final HandlerInterceptor[] getAdaptedInterceptors() {
@ -376,8 +377,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -376,8 +377,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
}
/**
* Return all configured {@link MappedInterceptor MappedInterceptors} as an array.
* @return the array of {@link MappedInterceptor MappedInterceptors}, or {@code null} if none
* Return all configured {@link MappedInterceptor}s as an array.
* @return the array of {@link MappedInterceptor}s, or {@code null} if none
*/
@Nullable
protected final MappedInterceptor[] getMappedInterceptors() {
@ -456,7 +457,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -456,7 +457,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
* Build a {@link HandlerExecutionChain} for the given handler, including
* applicable interceptors.
* <p>The default implementation builds a standard {@link HandlerExecutionChain}
* with the given handler, the handler mapping's common interceptors, and any
* with the given handler, the common interceptors of the handler mapping, and any
* {@link MappedInterceptor MappedInterceptors} matching to the current request URL. Interceptors
* are added in the order they were registered. Subclasses may override this
* in order to extend/rearrange the list of interceptors.
@ -527,12 +528,12 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport @@ -527,12 +528,12 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
if (CorsUtils.isPreFlightRequest(request)) {
HandlerInterceptor[] interceptors = chain.getInterceptors();
chain = new HandlerExecutionChain(new PreFlightHandler(config), interceptors);
return new HandlerExecutionChain(new PreFlightHandler(config), interceptors);
}
else {
chain.addInterceptor(new CorsInterceptor(config));
return chain;
}
return chain;
}

3
spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/CookieLocaleResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 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.
@ -335,7 +335,6 @@ public class CookieLocaleResolver extends CookieGenerator implements LocaleConte @@ -335,7 +335,6 @@ public class CookieLocaleResolver extends CookieGenerator implements LocaleConte
* @see #setDefaultLocale
* @see javax.servlet.http.HttpServletRequest#getLocale()
*/
@Nullable
protected Locale determineDefaultLocale(HttpServletRequest request) {
Locale defaultLocale = getDefaultLocale();
if (defaultLocale == null) {

Loading…
Cancel
Save