From a02fd7c9953b8e7f629f4d3a66a450a13341576b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 29 Feb 2016 15:05:50 +0100 Subject: [PATCH] RequestMappingHandlerAdapter properly invokes handler method in case of no session as well Issue: SPR-13999 --- .../method/annotation/RequestMappingHandlerAdapter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 5960cde711..259bcc89e3 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 @@ -725,7 +725,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter protected ModelAndView handleInternal(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod) throws Exception { - ModelAndView mav = null; + ModelAndView mav; checkRequest(request); // Execute invokeHandlerMethod in synchronized block if required. @@ -737,8 +737,13 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter mav = invokeHandlerMethod(request, response, handlerMethod); } } + else { + // No HttpSession available -> no mutex necessary + mav = invokeHandlerMethod(request, response, handlerMethod); + } } else { + // No synchronization on session demanded at all... mav = invokeHandlerMethod(request, response, handlerMethod); }