Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.3.20
-
None
Description
when configuration an action with the annotation
@Action(value = "/doSubmitCity") @InputConfig(methodName = "validationFail") public void doSubmitCity() { //The action implementation }
The action class is integration with spring aop. (CGLIB proxy)
And use struts validation framework to do the data validation.
When the data validation fails. tracing the code to DefaultWorkflowInterceptor.java
protected String processInputConfig(final Object action, final String method, final String currentResultName) throws Exception { String resultName = currentResultName; InputConfig annotation = action.getClass().getMethod(method, EMPTY_CLASS_ARRAY).getAnnotation(InputConfig.class); if (annotation != null) { if (!annotation.methodName().equals("")) { Method m = action.getClass().getMethod(annotation.methodName()); resultName = (String) m.invoke(action); } else { resultName = annotation.resultName(); } if (LOG.isDebugEnabled()) { LOG.debug("Changing result name from [#0] to [#1] because of processing annotation [#2] on action [#3]", currentResultName, resultName, InputConfig.class.getSimpleName(), action); } } return resultName; }
This code, action.getClass().getMethod(method, EMPTY_CLASS_ARRAY).getAnnotation(InputConfig.class) cannot get any annotation because the class is proxied.
The following stack trace is printing in the log:
Could not find action or result: /test-extjs/login/doLogin.action No result defined for action com.huawei.test.action.login.LoginAction and result input at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
But at the same time, the @Action annotation is still working fine.
Attachments
Issue Links
- requires
-
WW-4694 AnnotationWorkflowInterceptor doesn't work with spring proxied action
- Closed
- links to