WW-3714 Marker interface migration follow-up

This commit is contained in:
Kusal Kithul-Godage
2024-10-17 19:28:41 +11:00
parent 7ce8f484e0
commit ebedd7391f
23 changed files with 73 additions and 66 deletions
@@ -20,21 +20,22 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.security.AcceptedPatternsChecker;
import com.opensymphony.xwork2.security.ExcludedPatternsChecker;
import com.opensymphony.xwork2.util.ClearableValueStack;
import com.opensymphony.xwork2.util.Evaluated;
import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.Parameter;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.interceptor.ValidationAware;
import java.util.Map;
@@ -108,7 +109,7 @@ public class AliasInterceptor extends AbstractInterceptor {
@Inject(StrutsConstants.STRUTS_DEVMODE)
public void setDevMode(String mode) {
this.devMode = Boolean.parseBoolean(mode);
}
}
@Inject
public void setValueStackFactory(ValueStackFactory valueStackFactory) {
@@ -225,7 +226,7 @@ public class AliasInterceptor extends AbstractInterceptor {
LOG.debug("invalid alias expression: {}", aliasesKey);
}
}
return invocation.invoke();
}
@@ -21,18 +21,23 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionChainResult;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.Unchainable;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.CompoundRoot;
import com.opensymphony.xwork2.util.ProxyUtil;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.Unchainable;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/**
@@ -24,6 +24,7 @@ import com.opensymphony.xwork2.conversion.impl.ConversionData;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.struts2.interceptor.ValidationAware;
import java.util.HashMap;
import java.util.Map;
@@ -25,6 +25,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ValidationAware;
import org.apache.struts2.interceptor.ValidationErrorAware;
import org.apache.struts2.interceptor.ValidationWorkflowAware;
/**
* <!-- START SNIPPET: description -->
@@ -19,9 +19,9 @@
package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.util.CompoundRoot;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ModelDriven;
/**
* <!-- START SNIPPET: description -->
@@ -19,9 +19,7 @@
package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Preparable;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.struts2.Preparable;
import java.lang.reflect.InvocationTargetException;
@@ -24,6 +24,7 @@ import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.StrutsException;
import org.apache.struts2.interceptor.ScopedModelDriven;
import java.lang.reflect.Method;
import java.util.Map;
@@ -20,11 +20,11 @@ package com.opensymphony.xwork2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.Parameterizable;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ClearableValueStack;
import com.opensymphony.xwork2.LocalizedTextProvider;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
@@ -34,6 +34,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.interceptor.ValidationAware;
import java.util.Collections;
import java.util.Map;
@@ -20,11 +20,11 @@ package com.opensymphony.xwork2.util;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.util.reflection.ReflectionProviderFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ModelDriven;
import java.beans.PropertyDescriptor;
import java.util.Locale;
@@ -135,7 +135,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
* object. If so, repeat the entire process from the beginning with the object's class as
* aClass and "address.state" as the message key.</li>
* <li>If not found, look for the message in aClass' package hierarchy.</li>
* <li>If still not found, look for the message in the default resource bundles
* <li>If still not found, look for the message in the default resource bundles
* (Note: the lookup is not repeated again if {@link #searchDefaultBundlesFirst} was <code>true</code>).</li>
* <li>Return defaultMessage</li>
* </ol>
@@ -190,7 +190,7 @@ public class StrutsLocalizedTextProvider extends AbstractLocalizedTextProvider {
* object. If so, repeat the entire process from the beginning with the object's class as
* aClass and "address.state" as the message key.</li>
* <li>If not found, look for the message in aClass' package hierarchy.</li>
* <li>If still not found, look for the message in the default resource bundles
* <li>If still not found, look for the message in the default resource bundles
* (Note: the lookup is not repeated again if {@link #searchDefaultBundlesFirst} was <code>true</code>).</li>
* <li>Return defaultMessage</li>
* </ol>
@@ -20,13 +20,13 @@ package com.opensymphony.xwork2.validator;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.Validateable;
/**
* <!-- START SNIPPET: description -->
@@ -71,9 +71,9 @@ import org.apache.logging.log4j.Logger;
* <li>programmatic - Defaults to true. If true and the action is Validateable call validate(),
* and any method that starts with "validate".
* </li>
*
*
* <li>declarative - Defaults to true. Perform validation based on xml or annotations.</li>
*
*
* </ul>
*
* <!-- END SNIPPET: parameters -->
@@ -90,14 +90,14 @@ import org.apache.logging.log4j.Logger;
*
* <pre>
* <!-- START SNIPPET: example -->
*
*
* &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
* &lt;interceptor-ref name=&quot;params&quot;/&gt;
* &lt;interceptor-ref name=&quot;validation&quot;/&gt;
* &lt;interceptor-ref name=&quot;workflow&quot;/&gt;
* &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
* &lt;/action&gt;
*
*
* &lt;-- in the following case myMethod of the action class will not
* get validated --&gt;
* &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
@@ -108,7 +108,7 @@ import org.apache.logging.log4j.Logger;
* &lt;interceptor-ref name=&quot;workflow&quot;/&gt;
* &lt;result name=&quot;success&quot;&gt;good_result.ftl&lt;/result&gt;
* &lt;/action&gt;
*
*
* &lt;-- in the following case only annotated methods of the action class will
* be validated --&gt;
* &lt;action name=&quot;someAction&quot; class=&quot;com.examples.SomeAction&quot;&gt;
@@ -138,9 +138,9 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
private final static String ALT_VALIDATE_PREFIX = "validateDo";
private boolean validateAnnotatedMethodOnly;
private ActionValidatorManager actionValidatorManager;
private boolean alwaysInvokeValidate = true;
private boolean programmatic = true;
private boolean declarative = true;
@@ -149,11 +149,11 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
public void setActionValidatorManager(ActionValidatorManager mgr) {
this.actionValidatorManager = mgr;
}
/**
* Determines if {@link Validateable}'s <code>validate()</code> should be called,
* as well as methods whose name that start with "validate". Defaults to "true".
*
*
* @param programmatic <tt>true</tt> then <code>validate()</code> is invoked.
*/
public void setProgrammatic(boolean programmatic) {
@@ -161,9 +161,9 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
}
/**
* Determines if validation based on annotations or xml should be performed. Defaults
* Determines if validation based on annotations or xml should be performed. Defaults
* to "true".
*
*
* @param declarative <tt>true</tt> then perform validation based on annotations or xml.
*/
public void setDeclarative(boolean declarative) {
@@ -171,9 +171,9 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
}
/**
* Determines if {@link Validateable}'s <code>validate()</code> should always
* Determines if {@link Validateable}'s <code>validate()</code> should always
* be invoked. Default to "true".
*
*
* @param alwaysInvokeValidate <tt>true</tt> then <code>validate()</code> is always invoked.
*/
public void setAlwaysInvokeValidate(String alwaysInvokeValidate) {
@@ -218,7 +218,7 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
if (LOG.isDebugEnabled()) {
LOG.debug("Validating {}/{} with method {}.", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), method);
}
if (declarative) {
if (validateAnnotatedMethodOnly) {
@@ -226,12 +226,12 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
} else {
actionValidatorManager.validate(action, context);
}
}
}
if (action instanceof Validateable && programmatic) {
// keep exception that might occured in validateXXX or validateDoXXX
Exception exception = null;
Exception exception = null;
Validateable validateable = (Validateable) action;
LOG.debug("Invoking validate() on action {}", validateable);
@@ -239,19 +239,19 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
PrefixMethodInvocationUtil.invokePrefixMethod(invocation, new String[]{VALIDATE_PREFIX, ALT_VALIDATE_PREFIX});
}
catch(Exception e) {
// If any exception occurred while doing reflection, we want
// If any exception occurred while doing reflection, we want
// validate() to be executed
LOG.warn("an exception occured while executing the prefix method", e);
exception = e;
}
if (alwaysInvokeValidate) {
validateable.validate();
}
if (exception != null) {
// rethrow if something is wrong while doing validateXXX / validateDoXXX
if (exception != null) {
// rethrow if something is wrong while doing validateXXX / validateDoXXX
throw exception;
}
}
@@ -262,7 +262,7 @@ public class ValidationInterceptor extends MethodFilterInterceptor {
doBeforeInvocation(invocation);
return invocation.invoke();
}
/**
* <p>
* Returns the context that will be used by the
@@ -25,7 +25,6 @@ import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.util.TextParseUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -20,7 +20,6 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.action.UploadedFilesAware;
@@ -18,14 +18,11 @@
*/
package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.result.ServletRedirectResult;
import java.util.ArrayList;
@@ -58,7 +55,7 @@ import java.util.Map;
*
* <p>
* In the 'AUTOMATIC' mode, the interceptor will always retrieve the stored action's message / errors
* and field errors and put them back into the {@link ValidationAware} action, and after Action execution,
* and field errors and put them back into the {@link ValidationAware} action, and after Action execution,
* if the {@link com.opensymphony.xwork2.Result} is an instance of {@link ServletRedirectResult}, the action's message / errors
* and field errors into automatically be stored in the HTTP session..
* </p>
@@ -21,7 +21,6 @@ package org.apache.struts2.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.interceptor.PreResultListener;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
@@ -20,7 +20,6 @@ package org.apache.struts.beanvalidation.validation.interceptor;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
@@ -33,6 +32,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts.beanvalidation.constraints.ValidationGroup;
import org.apache.struts.beanvalidation.validation.constant.ValidatorConstants;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.interceptor.validation.SkipValidation;
import javax.validation.ConstraintViolation;
@@ -24,7 +24,6 @@ import com.opensymphony.xwork2.ActionProxyFactory;
import com.opensymphony.xwork2.DefaultActionInvocation;
import com.opensymphony.xwork2.ValidationAwareSupport;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.dispatcher.ApplicationMap;
@@ -32,6 +31,7 @@ import org.apache.struts2.dispatcher.Dispatcher;
import org.apache.struts2.dispatcher.HttpParameters;
import org.apache.struts2.dispatcher.RequestMap;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.ValidationAware;
import org.directwebremoting.WebContextFactory;
import javax.servlet.ServletContext;
@@ -20,7 +20,6 @@ package org.apache.struts2.json;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.util.ValueStack;
@@ -29,6 +28,7 @@ import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.StrutsConstants;
import org.apache.struts2.json.smd.SMDGenerator;
@@ -20,13 +20,13 @@ package org.apache.struts2.json;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ValidationAware;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -21,9 +21,7 @@ package org.apache.struts2.oval.interceptor;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionProxy;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.interceptor.PrefixMethodInvocationUtil;
@@ -48,6 +46,7 @@ import ognl.OgnlException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.Validateable;
import org.apache.struts2.oval.annotation.Profiles;
import java.lang.reflect.Field;
@@ -19,9 +19,9 @@
package org.apache.struts2.rest;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.rest.handler.ContentTypeHandler;
@@ -18,19 +18,23 @@
*/
package org.apache.struts2.rest;
import com.opensymphony.xwork2.*;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.DefaultActionInvocation;
import com.opensymphony.xwork2.Result;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.result.HttpHeaderResult;
import org.apache.struts2.interceptor.ValidationAware;
import org.apache.struts2.rest.handler.ContentTypeHandler;
import org.apache.struts2.rest.handler.HtmlHandler;
import org.apache.struts2.result.HttpHeaderResult;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -74,7 +78,7 @@ public class RestActionInvocation extends DefaultActionInvocation {
/**
* If set to true (by default) blocks returning content from any other methods than GET,
* if set to false, the content can be returned for any kind of method
*
*
* @param restrictToGet true or false
*/
@Inject(value = RestConstants.REST_CONTENT_RESTRICT_TO_GET, required = false)
@@ -23,10 +23,10 @@ import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.interceptor.ValidationAware;
import java.util.HashMap;
import java.util.Map;
@@ -19,7 +19,6 @@
package org.apache.struts2.rest.handler;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ModelDriven;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.StaxDriver;
import com.thoughtworks.xstream.security.ArrayTypePermission;
@@ -29,6 +28,7 @@ import com.thoughtworks.xstream.security.PrimitiveTypePermission;
import com.thoughtworks.xstream.security.TypePermission;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ModelDriven;
import org.apache.struts2.rest.handler.xstream.XStreamAllowedClassNames;
import org.apache.struts2.rest.handler.xstream.XStreamAllowedClasses;
import org.apache.struts2.rest.handler.xstream.XStreamPermissionProvider;