From 0349abc565da1523daa84d42d5950ab2ebf12df2 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 29 Feb 2016 11:12:11 +0100 Subject: [PATCH] RequestMappingHandlerAdapter properly invokes handler method in synchronizeOnSession mode again Issue: SPR-13999 (cherry picked from commit 1815a6a) --- .../RequestMappingHandlerAdapter.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index f90b2a5cc61..9e84d356d95 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -117,8 +117,8 @@ import org.springframework.web.util.WebUtils; public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter implements BeanFactoryAware, InitializingBean { - private static final boolean completionStagePresent = ClassUtils.isPresent("java.util.concurrent.CompletionStage", - RequestMappingHandlerAdapter.class.getClassLoader()); + private static final boolean completionStagePresent = ClassUtils.isPresent( + "java.util.concurrent.CompletionStage", RequestMappingHandlerAdapter.class.getClassLoader()); private List customArgumentResolvers; @@ -444,7 +444,14 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter /** * Cache content produced by {@code @SessionAttributes} annotated handlers - * for the given number of seconds. Default is 0, preventing caching completely. + * for the given number of seconds. + *

Possible values are: + *

*

In contrast to the "cacheSeconds" property which will apply to all general * handlers (but not to {@code @SessionAttributes} annotated handlers), * this setting will apply to {@code @SessionAttributes} handlers only. @@ -727,8 +734,9 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter } } } - - mav = invokeHandlerMethod(request, response, handlerMethod); + else { + mav = invokeHandlerMethod(request, response, handlerMethod); + } if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) { applyCacheSeconds(response, this.cacheSecondsForSessionAttributeHandlers);