commit
766a23bd93
|
@ -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");
|
* 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.
|
||||||
|
@ -377,7 +377,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||||
for (TypeFilter filter : this.includeFilters) {
|
for (TypeFilter filter : this.includeFilters) {
|
||||||
String stereotype = extractStereotype(filter);
|
String stereotype = extractStereotype(filter);
|
||||||
if (stereotype == null) {
|
if (stereotype == null) {
|
||||||
throw new IllegalArgumentException("Failed to extract stereotype from "+ filter);
|
throw new IllegalArgumentException("Failed to extract stereotype from " + filter);
|
||||||
}
|
}
|
||||||
types.addAll(index.getCandidateTypes(basePackage, stereotype));
|
types.addAll(index.getCandidateTypes(basePackage, stereotype));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -435,7 +435,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||||
if (bean instanceof ImportAware) {
|
if (bean instanceof ImportAware) {
|
||||||
ImportRegistry ir = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class);
|
ImportRegistry ir = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class);
|
||||||
AnnotationMetadata importingClass = ir.getImportingClassFor(bean.getClass().getSuperclass().getName());
|
AnnotationMetadata importingClass = ir.getImportingClassFor(bean.getClass().getSuperclass().getName());
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -269,7 +269,7 @@ public abstract class AbstractApplicationEventMulticaster
|
||||||
* type before trying to instantiate it.
|
* type before trying to instantiate it.
|
||||||
* <p>If this method returns {@code true} for a given listener as a first pass,
|
* <p>If this method returns {@code true} for a given listener as a first pass,
|
||||||
* the listener instance will get retrieved and fully evaluated through a
|
* the listener instance will get retrieved and fully evaluated through a
|
||||||
* {@link #supportsEvent(ApplicationListener,ResolvableType, Class)} call afterwards.
|
* {@link #supportsEvent(ApplicationListener, ResolvableType, Class)} call afterwards.
|
||||||
* @param listenerType the listener's type as determined by the BeanFactory
|
* @param listenerType the listener's type as determined by the BeanFactory
|
||||||
* @param eventType the event type to check
|
* @param eventType the event type to check
|
||||||
* @return whether the given listener should be included in the candidates
|
* @return whether the given listener should be included in the candidates
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
||||||
throws NoSuchBeanDefinitionException{
|
throws NoSuchBeanDefinitionException {
|
||||||
|
|
||||||
assertBeanFactoryActive();
|
assertBeanFactoryActive();
|
||||||
return getBeanFactory().findAnnotationOnBean(beanName, annotationType);
|
return getBeanFactory().findAnnotationOnBean(beanName, annotationType);
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -377,7 +377,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
||||||
try {
|
try {
|
||||||
return bundle.getString(key);
|
return bundle.getString(key);
|
||||||
}
|
}
|
||||||
catch (MissingResourceException ex){
|
catch (MissingResourceException ex) {
|
||||||
// Assume key not found for some other reason
|
// Assume key not found for some other reason
|
||||||
// -> do NOT throw the exception to allow for checking parent message source.
|
// -> do NOT throw the exception to allow for checking parent message source.
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -43,7 +43,7 @@ import org.springframework.lang.Nullable;
|
||||||
* <p>For an implementation of a thread-based {@code Scope} with support for
|
* <p>For an implementation of a thread-based {@code Scope} with support for
|
||||||
* destruction callbacks, refer to the
|
* destruction callbacks, refer to the
|
||||||
* <a href="http://www.springbyexample.org/examples/custom-thread-scope-module.html">
|
* <a href="http://www.springbyexample.org/examples/custom-thread-scope-module.html">
|
||||||
* Spring by Example Custom Thread Scope Module</a>.
|
* Spring by Example Custom Thread Scope Module</a>.
|
||||||
*
|
*
|
||||||
* <p>Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
|
* <p>Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
|
||||||
*
|
*
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -960,7 +960,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
.collect(Collectors.joining(", "));
|
.collect(Collectors.joining(", "));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
params = (request.getParameterMap().isEmpty() ? "" : "masked");
|
params = (request.getParameterMap().isEmpty() ? "" : "masked");
|
||||||
}
|
}
|
||||||
|
|
||||||
String query = StringUtils.isEmpty(request.getQueryString()) ? "" : "?" + request.getQueryString();
|
String query = StringUtils.isEmpty(request.getQueryString()) ? "" : "?" + request.getQueryString();
|
||||||
|
@ -1166,7 +1166,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
logger.trace("Request already resolved to MultipartHttpServletRequest, e.g. by MultipartFilter");
|
logger.trace("Request already resolved to MultipartHttpServletRequest, e.g. by MultipartFilter");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hasMultipartException(request) ) {
|
else if (hasMultipartException(request)) {
|
||||||
logger.debug("Multipart resolution previously failed for current request - " +
|
logger.debug("Multipart resolution previously failed for current request - " +
|
||||||
"skipping re-resolution for undisturbed error rendering");
|
"skipping re-resolution for undisturbed error rendering");
|
||||||
}
|
}
|
||||||
|
@ -1432,7 +1432,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
* @param attributesSnapshot the snapshot of the request attributes before the include
|
* @param attributesSnapshot the snapshot of the request attributes before the include
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?> attributesSnapshot) {
|
private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?, ?> attributesSnapshot) {
|
||||||
// Need to copy into separate Collection here, to avoid side effects
|
// Need to copy into separate Collection here, to avoid side effects
|
||||||
// on the Enumeration when removing attributes.
|
// on the Enumeration when removing attributes.
|
||||||
Set<String> attrsToCheck = new HashSet<>();
|
Set<String> attrsToCheck = new HashSet<>();
|
||||||
|
@ -1451,7 +1451,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
// or removing the attribute, respectively, if appropriate.
|
// or removing the attribute, respectively, if appropriate.
|
||||||
for (String attrName : attrsToCheck) {
|
for (String attrName : attrsToCheck) {
|
||||||
Object attrValue = attributesSnapshot.get(attrName);
|
Object attrValue = attributesSnapshot.get(attrName);
|
||||||
if (attrValue == null){
|
if (attrValue == null) {
|
||||||
request.removeAttribute(attrName);
|
request.removeAttribute(attrName);
|
||||||
}
|
}
|
||||||
else if (attrValue != request.getAttribute(attrName)) {
|
else if (attrValue != request.getAttribute(attrName)) {
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -213,7 +213,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
configurePathMatchingProperties(handlerMappingDef, element, context);
|
configurePathMatchingProperties(handlerMappingDef, element, context);
|
||||||
readerContext.getRegistry().registerBeanDefinition(HANDLER_MAPPING_BEAN_NAME , handlerMappingDef);
|
readerContext.getRegistry().registerBeanDefinition(HANDLER_MAPPING_BEAN_NAME, handlerMappingDef);
|
||||||
|
|
||||||
RuntimeBeanReference corsRef = MvcNamespaceUtils.registerCorsConfigurations(null, context, source);
|
RuntimeBeanReference corsRef = MvcNamespaceUtils.registerCorsConfigurations(null, context, source);
|
||||||
handlerMappingDef.getPropertyValues().add("corsConfigurations", corsRef);
|
handlerMappingDef.getPropertyValues().add("corsConfigurations", corsRef);
|
||||||
|
@ -265,7 +265,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
|
|
||||||
handlerAdapterDef.getPropertyValues().add("callableInterceptors", callableInterceptors);
|
handlerAdapterDef.getPropertyValues().add("callableInterceptors", callableInterceptors);
|
||||||
handlerAdapterDef.getPropertyValues().add("deferredResultInterceptors", deferredResultInterceptors);
|
handlerAdapterDef.getPropertyValues().add("deferredResultInterceptors", deferredResultInterceptors);
|
||||||
readerContext.getRegistry().registerBeanDefinition(HANDLER_ADAPTER_BEAN_NAME , handlerAdapterDef);
|
readerContext.getRegistry().registerBeanDefinition(HANDLER_ADAPTER_BEAN_NAME, handlerAdapterDef);
|
||||||
|
|
||||||
RootBeanDefinition uriContributorDef =
|
RootBeanDefinition uriContributorDef =
|
||||||
new RootBeanDefinition(CompositeUriComponentsContributorFactoryBean.class);
|
new RootBeanDefinition(CompositeUriComponentsContributorFactoryBean.class);
|
||||||
|
@ -391,7 +391,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||||
factoryBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
factoryBeanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
factoryBeanDef.getPropertyValues().add("mediaTypes", getDefaultMediaTypes());
|
factoryBeanDef.getPropertyValues().add("mediaTypes", getDefaultMediaTypes());
|
||||||
String name = CONTENT_NEGOTIATION_MANAGER_BEAN_NAME;
|
String name = CONTENT_NEGOTIATION_MANAGER_BEAN_NAME;
|
||||||
context.getReaderContext().getRegistry().registerBeanDefinition(name , factoryBeanDef);
|
context.getReaderContext().getRegistry().registerBeanDefinition(name, factoryBeanDef);
|
||||||
context.registerComponent(new BeanComponentDefinition(factoryBeanDef, name));
|
context.registerComponent(new BeanComponentDefinition(factoryBeanDef, name));
|
||||||
beanRef = new RuntimeBeanReference(name);
|
beanRef = new RuntimeBeanReference(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -123,7 +123,7 @@ public abstract class MvcNamespaceUtils {
|
||||||
* name unless already registered.
|
* name unless already registered.
|
||||||
*/
|
*/
|
||||||
private static void registerBeanNameUrlHandlerMapping(ParserContext context, @Nullable Object source) {
|
private static void registerBeanNameUrlHandlerMapping(ParserContext context, @Nullable Object source) {
|
||||||
if (!context.getRegistry().containsBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME)){
|
if (!context.getRegistry().containsBeanDefinition(BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME)) {
|
||||||
RootBeanDefinition mappingDef = new RootBeanDefinition(BeanNameUrlHandlerMapping.class);
|
RootBeanDefinition mappingDef = new RootBeanDefinition(BeanNameUrlHandlerMapping.class);
|
||||||
mappingDef.setSource(source);
|
mappingDef.setSource(source);
|
||||||
mappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
mappingDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
|
@ -195,7 +195,7 @@ public abstract class MvcNamespaceUtils {
|
||||||
* unless already registered.
|
* unless already registered.
|
||||||
*/
|
*/
|
||||||
private static void registerHandlerMappingIntrospector(ParserContext parserContext, @Nullable Object source) {
|
private static void registerHandlerMappingIntrospector(ParserContext parserContext, @Nullable Object source) {
|
||||||
if (!parserContext.getRegistry().containsBeanDefinition(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)){
|
if (!parserContext.getRegistry().containsBeanDefinition(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) {
|
||||||
RootBeanDefinition beanDef = new RootBeanDefinition(HandlerMappingIntrospector.class);
|
RootBeanDefinition beanDef = new RootBeanDefinition(HandlerMappingIntrospector.class);
|
||||||
beanDef.setSource(source);
|
beanDef.setSource(source);
|
||||||
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -179,7 +179,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
|
||||||
}
|
}
|
||||||
else if (useTrailingSlashMatch()) {
|
else if (useTrailingSlashMatch()) {
|
||||||
if (!registeredPattern.endsWith("/") && getPathMatcher().match(registeredPattern + "/", urlPath)) {
|
if (!registeredPattern.endsWith("/") && getPathMatcher().match(registeredPattern + "/", urlPath)) {
|
||||||
matchingPatterns.add(registeredPattern +"/");
|
matchingPatterns.add(registeredPattern + "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -73,7 +73,7 @@ public class HandlerExceptionResolverComposite implements HandlerExceptionResolv
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response,
|
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response,
|
||||||
@Nullable Object handler,Exception ex) {
|
@Nullable Object handler, Exception ex) {
|
||||||
|
|
||||||
if (this.resolvers != null) {
|
if (this.resolvers != null) {
|
||||||
for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) {
|
for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) {
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -256,7 +256,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
|
||||||
}
|
}
|
||||||
if (this.useTrailingSlashMatch) {
|
if (this.useTrailingSlashMatch) {
|
||||||
if (!pattern.endsWith("/") && this.pathMatcher.match(pattern + "/", lookupPath)) {
|
if (!pattern.endsWith("/") && this.pathMatcher.match(pattern + "/", lookupPath)) {
|
||||||
return pattern +"/";
|
return pattern + "/";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -46,7 +46,7 @@ public class RequestMappingInfoHandlerMethodMappingNamingStrategy
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String simpleTypeName = handlerMethod.getBeanType().getSimpleName();
|
String simpleTypeName = handlerMethod.getBeanType().getSimpleName();
|
||||||
for (int i = 0 ; i < simpleTypeName.length(); i++) {
|
for (int i = 0; i < simpleTypeName.length(); i++) {
|
||||||
if (Character.isUpperCase(simpleTypeName.charAt(i))) {
|
if (Character.isUpperCase(simpleTypeName.charAt(i))) {
|
||||||
sb.append(simpleTypeName.charAt(i));
|
sb.append(simpleTypeName.charAt(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -127,7 +127,7 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||||
* resolution use {@link #setArgumentResolvers} instead.
|
* resolution use {@link #setArgumentResolvers} instead.
|
||||||
*/
|
*/
|
||||||
public void setCustomArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) {
|
public void setCustomArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||||
this.customArgumentResolvers= argumentResolvers;
|
this.customArgumentResolvers = argumentResolvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -50,14 +50,14 @@ public class SessionAttributeMethodArgumentResolver extends AbstractNamedValueMe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request){
|
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request) {
|
||||||
return request.getAttribute(name, RequestAttributes.SCOPE_SESSION);
|
return request.getAttribute(name, RequestAttributes.SCOPE_SESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletException {
|
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletException {
|
||||||
throw new ServletRequestBindingException("Missing session attribute '" + name +
|
throw new ServletRequestBindingException("Missing session attribute '" + name +
|
||||||
"' of type " + parameter.getNestedParameterType().getSimpleName());
|
"' of type " + parameter.getNestedParameterType().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -50,7 +50,7 @@ public class ViewMethodReturnValueHandler implements HandlerMethodReturnValueHan
|
||||||
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
|
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
|
||||||
|
|
||||||
if (returnValue instanceof View){
|
if (returnValue instanceof View) {
|
||||||
View view = (View) returnValue;
|
View view = (View) returnValue;
|
||||||
mavContainer.setView(view);
|
mavContainer.setView(view);
|
||||||
if (view instanceof SmartView && ((SmartView) view).isRedirectView()) {
|
if (view instanceof SmartView && ((SmartView) view).isRedirectView()) {
|
||||||
|
|
|
@ -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");
|
* 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.
|
||||||
|
@ -87,7 +87,7 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
|
||||||
mavContainer.setRedirectModelScenario(true);
|
mavContainer.setRedirectModelScenario(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (returnValue != null){
|
else if (returnValue != null) {
|
||||||
// should not happen
|
// should not happen
|
||||||
throw new UnsupportedOperationException("Unexpected return type: " +
|
throw new UnsupportedOperationException("Unexpected return type: " +
|
||||||
returnType.getParameterType().getName() + " in method: " + returnType.getMethod());
|
returnType.getParameterType().getName() + " in method: " + returnType.getMethod());
|
||||||
|
|
Loading…
Reference in New Issue