|
1 | 1 | /* |
2 | | - * Copyright 2002-2015 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
117 | 117 | public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter |
118 | 118 | implements BeanFactoryAware, InitializingBean { |
119 | 119 |
|
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()); |
122 | 122 |
|
123 | 123 |
|
124 | 124 | private List<HandlerMethodArgumentResolver> customArgumentResolvers; |
@@ -444,7 +444,14 @@ public void setSessionAttributeStore(SessionAttributeStore sessionAttributeStore |
444 | 444 |
|
445 | 445 | /** |
446 | 446 | * 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> |
448 | 455 | * <p>In contrast to the "cacheSeconds" property which will apply to all general |
449 | 456 | * handlers (but not to {@code @SessionAttributes} annotated handlers), |
450 | 457 | * this setting will apply to {@code @SessionAttributes} handlers only. |
@@ -727,8 +734,9 @@ protected ModelAndView handleInternal(HttpServletRequest request, |
727 | 734 | } |
728 | 735 | } |
729 | 736 | } |
730 | | - |
731 | | - mav = invokeHandlerMethod(request, response, handlerMethod); |
| 737 | + else { |
| 738 | + mav = invokeHandlerMethod(request, response, handlerMethod); |
| 739 | + } |
732 | 740 |
|
733 | 741 | if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) { |
734 | 742 | applyCacheSeconds(response, this.cacheSecondsForSessionAttributeHandlers); |
|
0 commit comments