|
|
|
@ -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"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -151,7 +151,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
|
|
|
|
|
|
|
|
private List<HttpMessageConverter<?>> messageConverters; |
|
|
|
private List<HttpMessageConverter<?>> messageConverters; |
|
|
|
|
|
|
|
|
|
|
|
private List<Object> requestResponseBodyAdvice = new ArrayList<>(); |
|
|
|
private final List<Object> requestResponseBodyAdvice = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private WebBindingInitializer webBindingInitializer; |
|
|
|
private WebBindingInitializer webBindingInitializer; |
|
|
|
@ -180,7 +180,6 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private ConfigurableBeanFactory beanFactory; |
|
|
|
private ConfigurableBeanFactory beanFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<Class<?>, SessionAttributesHandler> sessionAttributesHandlerCache = new ConcurrentHashMap<>(64); |
|
|
|
private final Map<Class<?>, SessionAttributesHandler> sessionAttributesHandlerCache = new ConcurrentHashMap<>(64); |
|
|
|
|
|
|
|
|
|
|
|
private final Map<Class<?>, Set<Method>> initBinderCache = new ConcurrentHashMap<>(64); |
|
|
|
private final Map<Class<?>, Set<Method>> initBinderCache = new ConcurrentHashMap<>(64); |
|
|
|
@ -412,7 +411,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
* processing thread has exited and ends when the request is dispatched again |
|
|
|
* processing thread has exited and ends when the request is dispatched again |
|
|
|
* for further processing of the concurrently produced result. |
|
|
|
* for further processing of the concurrently produced result. |
|
|
|
* <p>If this value is not set, the default timeout of the underlying |
|
|
|
* <p>If this value is not set, the default timeout of the underlying |
|
|
|
* implementation is used, e.g. 10 seconds on Tomcat with Servlet 3. |
|
|
|
* implementation is used. |
|
|
|
* @param timeout the timeout value in milliseconds |
|
|
|
* @param timeout the timeout value in milliseconds |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setAsyncRequestTimeout(long timeout) { |
|
|
|
public void setAsyncRequestTimeout(long timeout) { |
|
|
|
@ -639,7 +638,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
* and custom resolvers provided via {@link #setCustomArgumentResolvers}. |
|
|
|
* and custom resolvers provided via {@link #setCustomArgumentResolvers}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() { |
|
|
|
private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() { |
|
|
|
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(); |
|
|
|
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(30); |
|
|
|
|
|
|
|
|
|
|
|
// Annotation-based argument resolution
|
|
|
|
// Annotation-based argument resolution
|
|
|
|
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false)); |
|
|
|
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false)); |
|
|
|
@ -686,7 +685,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
* methods including built-in and custom resolvers. |
|
|
|
* methods including built-in and custom resolvers. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<HandlerMethodArgumentResolver> getDefaultInitBinderArgumentResolvers() { |
|
|
|
private List<HandlerMethodArgumentResolver> getDefaultInitBinderArgumentResolvers() { |
|
|
|
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(); |
|
|
|
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(20); |
|
|
|
|
|
|
|
|
|
|
|
// Annotation-based argument resolution
|
|
|
|
// Annotation-based argument resolution
|
|
|
|
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false)); |
|
|
|
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false)); |
|
|
|
@ -719,7 +718,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
* custom handlers provided via {@link #setReturnValueHandlers}. |
|
|
|
* custom handlers provided via {@link #setReturnValueHandlers}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers() { |
|
|
|
private List<HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers() { |
|
|
|
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(); |
|
|
|
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>(20); |
|
|
|
|
|
|
|
|
|
|
|
// Single-purpose return value types
|
|
|
|
// Single-purpose return value types
|
|
|
|
handlers.add(new ModelAndViewMethodReturnValueHandler()); |
|
|
|
handlers.add(new ModelAndViewMethodReturnValueHandler()); |
|
|
|
@ -834,7 +833,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
synchronized (this.sessionAttributesHandlerCache) { |
|
|
|
synchronized (this.sessionAttributesHandlerCache) { |
|
|
|
sessionAttrHandler = this.sessionAttributesHandlerCache.get(handlerType); |
|
|
|
sessionAttrHandler = this.sessionAttributesHandlerCache.get(handlerType); |
|
|
|
if (sessionAttrHandler == null) { |
|
|
|
if (sessionAttrHandler == null) { |
|
|
|
sessionAttrHandler = new SessionAttributesHandler(handlerType, sessionAttributeStore); |
|
|
|
sessionAttrHandler = new SessionAttributesHandler(handlerType, this.sessionAttributeStore); |
|
|
|
this.sessionAttributesHandlerCache.put(handlerType, sessionAttrHandler); |
|
|
|
this.sessionAttributesHandlerCache.put(handlerType, sessionAttrHandler); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -957,9 +956,9 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
|
|
|
} |
|
|
|
} |
|
|
|
List<InvocableHandlerMethod> initBinderMethods = new ArrayList<>(); |
|
|
|
List<InvocableHandlerMethod> initBinderMethods = new ArrayList<>(); |
|
|
|
// Global methods first
|
|
|
|
// Global methods first
|
|
|
|
this.initBinderAdviceCache.forEach((clazz, methodSet) -> { |
|
|
|
this.initBinderAdviceCache.forEach((controllerAdviceBean, methodSet) -> { |
|
|
|
if (clazz.isApplicableToBeanType(handlerType)) { |
|
|
|
if (controllerAdviceBean.isApplicableToBeanType(handlerType)) { |
|
|
|
Object bean = clazz.resolveBean(); |
|
|
|
Object bean = controllerAdviceBean.resolveBean(); |
|
|
|
for (Method method : methodSet) { |
|
|
|
for (Method method : methodSet) { |
|
|
|
initBinderMethods.add(createInitBinderMethod(bean, method)); |
|
|
|
initBinderMethods.add(createInitBinderMethod(bean, method)); |
|
|
|
} |
|
|
|
} |
|
|
|
|