This content has been marked as final.
Show 3 replies
-
1. Re: try catch around annotated method
msznapka.martin.sznapka.gmail.com Mar 17, 2008 2:12 PM (in response to msznapka.martin.sznapka.gmail.com)We tried one of the possible solutions, but the vpInterceptorMethod(...) is not called.
Any idea why not?We have interceptor:
@Interceptor public class VpInterceptor { @AroundInvoke public Object vpInterceptorMethod(InvocationContext invocation) throws Exception { log.debug("InterceptorMethod"); try { invocation.proceed(); } catch(Exception e) { // } } }
And annotation:
@Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Interceptors(VpInterceptor.class) public @interface VpAnnotation {}
And annotated method - test():
@Name("testEvent") @Scope(ScopeType.EVENT) public class TestEvent { @VpAnnotation public void test() { log.debug("Action - test"); } //other stuff }
-
2. Re: try catch around annotated method
pmuir Mar 19, 2008 11:10 AM (in response to msznapka.martin.sznapka.gmail.com)Right approach, but Seam doesn't support method level interceptors, only class level interceptors. So you can attach the interceptor at class level, and then mark the method with the same annotation, and only intercept those.