[
https://issues.apache.org/struts/browse/WW-2587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43618#action_43618
]
Brad Cupit commented on WW-2587:
--------------------------------
xwork has a utility method: AnnotationUtils.findAnnotatedMethods() which
appears to check superclass methods for annotations. There would still be more
work to determine that the 'current' action method being called overrides the
superclass method found by AnnotationUtils.findAnnotatedMethods(), but it
shouldn't be hard.
I do agree that the appropriate place to put the @SkipValidation support is
with the rest of the annotation validation. Having said that, I'm very
interested in getting this issue addressed, and if a major refactoring of
annotation validation, or, if having to take the Struts 2 feature of
@SkipValidation and port it to xwork poses a problem, I'd favor getting it
fixed quickly. Of course, I'm not the one who has to maintain the S2 codebase,
so I'm very biased. :-)
> @SkipValidation not found on superclass method
> ----------------------------------------------
>
> Key: WW-2587
> URL: https://issues.apache.org/struts/browse/WW-2587
> Project: Struts 2
> Issue Type: Bug
> Components: Core Interceptors
> Reporter: Brad Cupit
>
> The SkipValidation annotation is a great addition, but it would be nice if it
> was found on super class methods (i.e. the method being overridden) and/or
> interfaces.
> I have a CGLIB-generated proxy for my Action (created by Spring) so the
> SkipValidation annotation is never found, since CGLIB-proxies extend the
> class they proxy.
> Admittedly, this is more of a problem with CGLIB, than with Struts2, however
> if @SkipValidation were allowed on methods in interfaces or superclasses, my
> problem would be solved.
> Unfortunately, the validation annotations (like @RequiredStringValidator),
> are found on super classes. So the net effect is that my SkipValidation
> annotation is not found, but the validation annotations are, which means
> validation is occurring when it shouldn't.
> potential workarounds:
> a) use one action method per Action so validation can always be done for that
> entire class, or
> b) use excludeMethods param when configuring the validation interceptor in
> struts.xml
> Note that for option b) to work with zero-configuration, the @ParentPackage
> annotation must be applied to the Action class that will use the package
> defined in struts.xml
> Ideal fix:
> The AnnotationValidationInterceptor#doIntercept(ActionInvocation) method
> would check for the SkipValidation annotation on the method being overridden.
> This would not only fix the CGLIB-proxy issue, but would also allow
> SkipValidation to be used on interfaces and superclasses.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.