mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
XW-640 Support multiple unknown handlers
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@727100 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -193,4 +193,6 @@ public final class StrutsConstants {
|
||||
/** The {@link org.apache.struts2.dispatcher.StaticContentLoader} implementation class */
|
||||
public static final String STRUTS_STATIC_CONTENT_LOADER = "struts.staticContentLoader";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.UnknownHandlerManager} implementation class */
|
||||
public static final String STRUTS_UNKNOWN_HANDLER_MANAGER = "struts.unknownHandlerManager";
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.apache.struts2.views.velocity.VelocityManager;
|
||||
import com.opensymphony.xwork2.ActionProxyFactory;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.TextProvider;
|
||||
import com.opensymphony.xwork2.UnknownHandlerManager;
|
||||
import com.opensymphony.xwork2.config.Configuration;
|
||||
import com.opensymphony.xwork2.config.ConfigurationException;
|
||||
import com.opensymphony.xwork2.config.ConfigurationProvider;
|
||||
@@ -46,10 +47,7 @@ import com.opensymphony.xwork2.inject.ContainerBuilder;
|
||||
import com.opensymphony.xwork2.inject.Context;
|
||||
import com.opensymphony.xwork2.inject.Factory;
|
||||
import com.opensymphony.xwork2.inject.Scope;
|
||||
import com.opensymphony.xwork2.util.ClassLoaderUtil;
|
||||
import com.opensymphony.xwork2.util.LocalizedTextUtil;
|
||||
import com.opensymphony.xwork2.util.PatternMatcher;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
import com.opensymphony.xwork2.util.*;
|
||||
import com.opensymphony.xwork2.util.location.LocatableProperties;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
@@ -218,6 +216,7 @@ public class BeanSelectionProvider implements ConfigurationProvider {
|
||||
alias(ReflectionContextFactory.class, StrutsConstants.STRUTS_REFLECTIONCONTEXTFACTORY, builder, props);
|
||||
alias(PatternMatcher.class, StrutsConstants.STRUTS_PATTERNMATCHER, builder, props);
|
||||
alias(StaticContentLoader.class, StrutsConstants.STRUTS_STATIC_CONTENT_LOADER, builder, props);
|
||||
alias(UnknownHandlerManager.class, StrutsConstants.STRUTS_UNKNOWN_HANDLER_MANAGER, builder, props);
|
||||
|
||||
if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
|
||||
props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
<bean class="org.apache.struts2.views.jsp.ui.OgnlTool" />
|
||||
|
||||
<bean type="org.apache.struts2.dispatcher.StaticContentLoader" class="org.apache.struts2.dispatcher.DefaultStaticContentLoader" name="struts" />
|
||||
<bean type="com.opensymphony.xwork2.UnknownHandlerManager" class="com.opensymphony.xwork2.DefaultUnknownHandlerManager" name="struts" />
|
||||
|
||||
<!-- Silly workarounds for OGNL since there is currently no way to flush its internal caches -->
|
||||
<bean type="ognl.PropertyAccessor" name="java.util.ArrayList" class="com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor" />
|
||||
|
||||
@@ -24,6 +24,7 @@ package org.apache.struts2.rest;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.DefaultActionInvocation;
|
||||
import com.opensymphony.xwork2.Result;
|
||||
import com.opensymphony.xwork2.UnknownHandlerManager;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
@@ -81,9 +82,9 @@ public class RestActionInvocation extends DefaultActionInvocation {
|
||||
method = getAction().getClass().getMethod(altMethodName, new Class[0]);
|
||||
} catch (NoSuchMethodException e1) {
|
||||
// well, give the unknown handler a shot
|
||||
if (unknownHandler != null) {
|
||||
if (unknownHandlerManager.hasUnknownHandlers()) {
|
||||
try {
|
||||
methodResult = unknownHandler.handleUnknownActionMethod(action, methodName);
|
||||
methodResult = unknownHandlerManager.handleUnknownMethod(action, methodName);
|
||||
methodCalled = true;
|
||||
} catch (NoSuchMethodException e2) {
|
||||
// throw the original one
|
||||
|
||||
Reference in New Issue
Block a user