From e68f2f0a5fcf583ea15f6c5b0a7377408b1844aa Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 6 Sep 2010 21:44:06 +0000 Subject: [PATCH] removed unused HandlerExecutionChain caching --- .../web/portlet/DispatcherPortlet.java | 33 ++++--------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java index 843643145e..71a2c90439 100644 --- a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java +++ b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/DispatcherPortlet.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -171,13 +171,6 @@ public class DispatcherPortlet extends FrameworkPortlet { */ public static final String DEFAULT_VIEW_RENDERER_URL = "/WEB-INF/servlet/view"; - /** - * Request attribute to hold the currently chosen HandlerExecutionChain. - * Only used for internal optimizations. - */ - public static final String HANDLER_EXECUTION_CHAIN_ATTRIBUTE = - DispatcherPortlet.class.getName() + ".HANDLER"; - /** * Unlike the Servlet version of this class, we have to deal with the * two-phase nature of the portlet request. To do this, we need to pass @@ -622,7 +615,7 @@ public class DispatcherPortlet extends FrameworkPortlet { processedRequest = checkMultipart(request); // Determine handler for the current request. - mappedHandler = getHandler(processedRequest, false); + mappedHandler = getHandler(processedRequest); if (mappedHandler == null || mappedHandler.getHandler() == null) { noHandlerFound(processedRequest, response); return; @@ -701,7 +694,7 @@ public class DispatcherPortlet extends FrameworkPortlet { ModelAndView mv; try { // Determine handler for the current request. - mappedHandler = getHandler(request, false); + mappedHandler = getHandler(request); if (mappedHandler == null || mappedHandler.getHandler() == null) { noHandlerFound(request, response); return; @@ -807,7 +800,7 @@ public class DispatcherPortlet extends FrameworkPortlet { ModelAndView mv; try { // Determine handler for the current request. - mappedHandler = getHandler(request, false); + mappedHandler = getHandler(request); if (mappedHandler == null || mappedHandler.getHandler() == null) { noHandlerFound(request, response); return; @@ -896,7 +889,7 @@ public class DispatcherPortlet extends FrameworkPortlet { try { // Determine handler for the current request. - mappedHandler = getHandler(request, false); + mappedHandler = getHandler(request); if (mappedHandler == null || mappedHandler.getHandler() == null) { noHandlerFound(request, response); return; @@ -973,26 +966,14 @@ public class DispatcherPortlet extends FrameworkPortlet { * @param cache whether to cache the HandlerExecutionChain in a request attribute * @return the HandlerExceutionChain, or null if no handler could be found */ - protected HandlerExecutionChain getHandler(PortletRequest request, boolean cache) throws Exception { - HandlerExecutionChain handler = - (HandlerExecutionChain) request.getAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE); - if (handler != null) { - if (!cache) { - request.removeAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE); - } - return handler; - } - + protected HandlerExecutionChain getHandler(PortletRequest request) throws Exception { for (HandlerMapping hm : this.handlerMappings) { if (logger.isDebugEnabled()) { logger.debug( "Testing handler map [" + hm + "] in DispatcherPortlet with name '" + getPortletName() + "'"); } - handler = hm.getHandler(request); + HandlerExecutionChain handler = hm.getHandler(request); if (handler != null) { - if (cache) { - request.setAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE, handler); - } return handler; } }