removed unused HandlerExecutionChain caching
This commit is contained in:
parent
45d9b0cb2d
commit
e68f2f0a5f
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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";
|
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
|
* 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
|
* 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);
|
processedRequest = checkMultipart(request);
|
||||||
|
|
||||||
// Determine handler for the current request.
|
// Determine handler for the current request.
|
||||||
mappedHandler = getHandler(processedRequest, false);
|
mappedHandler = getHandler(processedRequest);
|
||||||
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
||||||
noHandlerFound(processedRequest, response);
|
noHandlerFound(processedRequest, response);
|
||||||
return;
|
return;
|
||||||
|
|
@ -701,7 +694,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
ModelAndView mv;
|
ModelAndView mv;
|
||||||
try {
|
try {
|
||||||
// Determine handler for the current request.
|
// Determine handler for the current request.
|
||||||
mappedHandler = getHandler(request, false);
|
mappedHandler = getHandler(request);
|
||||||
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
||||||
noHandlerFound(request, response);
|
noHandlerFound(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
@ -807,7 +800,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
ModelAndView mv;
|
ModelAndView mv;
|
||||||
try {
|
try {
|
||||||
// Determine handler for the current request.
|
// Determine handler for the current request.
|
||||||
mappedHandler = getHandler(request, false);
|
mappedHandler = getHandler(request);
|
||||||
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
||||||
noHandlerFound(request, response);
|
noHandlerFound(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
@ -896,7 +889,7 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Determine handler for the current request.
|
// Determine handler for the current request.
|
||||||
mappedHandler = getHandler(request, false);
|
mappedHandler = getHandler(request);
|
||||||
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
if (mappedHandler == null || mappedHandler.getHandler() == null) {
|
||||||
noHandlerFound(request, response);
|
noHandlerFound(request, response);
|
||||||
return;
|
return;
|
||||||
|
|
@ -973,26 +966,14 @@ public class DispatcherPortlet extends FrameworkPortlet {
|
||||||
* @param cache whether to cache the HandlerExecutionChain in a request attribute
|
* @param cache whether to cache the HandlerExecutionChain in a request attribute
|
||||||
* @return the HandlerExceutionChain, or null if no handler could be found
|
* @return the HandlerExceutionChain, or null if no handler could be found
|
||||||
*/
|
*/
|
||||||
protected HandlerExecutionChain getHandler(PortletRequest request, boolean cache) throws Exception {
|
protected HandlerExecutionChain getHandler(PortletRequest request) throws Exception {
|
||||||
HandlerExecutionChain handler =
|
|
||||||
(HandlerExecutionChain) request.getAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE);
|
|
||||||
if (handler != null) {
|
|
||||||
if (!cache) {
|
|
||||||
request.removeAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE);
|
|
||||||
}
|
|
||||||
return handler;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (HandlerMapping hm : this.handlerMappings) {
|
for (HandlerMapping hm : this.handlerMappings) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Testing handler map [" + hm + "] in DispatcherPortlet with name '" + getPortletName() + "'");
|
"Testing handler map [" + hm + "] in DispatcherPortlet with name '" + getPortletName() + "'");
|
||||||
}
|
}
|
||||||
handler = hm.getHandler(request);
|
HandlerExecutionChain handler = hm.getHandler(request);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
if (cache) {
|
|
||||||
request.setAttribute(HANDLER_EXECUTION_CHAIN_ATTRIBUTE, handler);
|
|
||||||
}
|
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue