struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4744) AnnotationWorkflowInterceptor should supports non-public annotated methods
Date Tue, 14 Feb 2017 07:17:41 GMT

    [ https://issues.apache.org/jira/browse/WW-4744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15865251#comment-15865251
] 

Lukasz Lenart commented on WW-4744:
-----------------------------------

I'm not sure if this is a good solution, why not just make this method public? Also why to
use {{ConcurrentHashMap as cache}}?

> AnnotationWorkflowInterceptor should supports non-public annotated methods
> --------------------------------------------------------------------------
>
>                 Key: WW-4744
>                 URL: https://issues.apache.org/jira/browse/WW-4744
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Interceptors
>            Reporter: zhouyanming
>
> {code:java}
> @Before
> protected String prepare(){
>     //TODO
>     return null;
> }
> {code}
> [https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java#L115]
> {code:java}
> List<Method> methods = new ArrayList<>(AnnotationUtils.getAnnotatedMethods(action.getClass(),
Before.class));
> {code}
> [https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/util/AnnotationUtils.java#L123]
> {code:java}
> for (Method m : clazz.getMethods()) 
> {code}
> clazz.getMethods() only return public methods, so method "prepare" will be excluded,
and protected modifier is a good practice for intercept method.We should improve AnnotationUtils.getAnnotatedMethods()
to return all methods. Perhaps use an ConcurrentHashMap as cache is much better.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message