Skip to content

Commit 0349abc

Browse files
committed
RequestMappingHandlerAdapter properly invokes handler method in synchronizeOnSession mode again
Issue: SPR-13999 (cherry picked from commit 1815a6a)
1 parent 9129ec2 commit 0349abc

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,8 +117,8 @@
117117
public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
118118
implements BeanFactoryAware, InitializingBean {
119119

120-
private static final boolean completionStagePresent = ClassUtils.isPresent("java.util.concurrent.CompletionStage",
121-
RequestMappingHandlerAdapter.class.getClassLoader());
120+
private static final boolean completionStagePresent = ClassUtils.isPresent(
121+
"java.util.concurrent.CompletionStage", RequestMappingHandlerAdapter.class.getClassLoader());
122122

123123

124124
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
@@ -444,7 +444,14 @@ public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore
444444

445445
/**
446446
* Cache content produced by {@code @SessionAttributes} annotated handlers
447-
* for the given number of seconds. Default is 0, preventing caching completely.
447+
* for the given number of seconds.
448+
* <p>Possible values are:
449+
* <ul>
450+
* <li>-1: no generation of cache-related headers</li>
451+
* <li>0 (default value): "Cache-Control: no-store" will prevent caching</li>
452+
* <li>1 or higher: "Cache-Control: max-age=seconds" will ask to cache content;
453+
* not advised when dealing with session attributes</li>
454+
* </ul>
448455
* <p>In contrast to the "cacheSeconds" property which will apply to all general
449456
* handlers (but not to {@code @SessionAttributes} annotated handlers),
450457
* this setting will apply to {@code @SessionAttributes} handlers only.
@@ -727,8 +734,9 @@ protected ModelAndView handleInternal(HttpServletRequest request,
727734
}
728735
}
729736
}
730-
731-
mav = invokeHandlerMethod(request, response, handlerMethod);
737+
else {
738+
mav = invokeHandlerMethod(request, response, handlerMethod);
739+
}
732740

733741
if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {
734742
applyCacheSeconds(response, this.cacheSecondsForSessionAttributeHandlers);

0 commit comments

Comments
 (0)