This content has been marked as final.
Show 6 replies
-
1. Re: Interceptor Question
cptnkirk Apr 24, 2007 11:57 AM (in response to xinhua)What Interceptors class are you importing, the Seam or EJB 3? The EJB 3 annotation needs to be run within an EJB 3 context.
-
2. Re: Interceptor Question
xinhua Apr 24, 2007 12:23 PM (in response to xinhua)hi, CptnKirk
the app is running on JBossAS 4.0.5 GA with ejb3 container
here is my complete codes:import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; public class PrintoutInterceptor { @AroundInvoke public void printOut(InvocationContext invocation) throws Exception { System.out.println("Method "+invocation.getMethod()+" is called"); invocation.proceed(); } }
import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.*; import javax.interceptor.Interceptors; @Target(METHOD) @Retention(RUNTIME) @Interceptors(PrintoutInterceptor.class) public @interface Printout { }
i changed the import like this :.... import org.jboss.seam.annotations.Interceptors; @Target(METHOD) @Retention(RUNTIME) @Interceptors(PrintoutInterceptor.class) public @interface Printout { }
it still doest work :...( -
3. Re: Interceptor Question
cptnkirk Apr 24, 2007 12:41 PM (in response to xinhua)So naturally this
.... @Printout public String register(.....) .....
method is part of an EJB 3 session bean right? -
4. Re: Interceptor Question
xinhua Apr 25, 2007 3:24 AM (in response to xinhua)"CptnKirk" wrote:
So naturally this.... @Printout public String register(.....) .....
method is part of an EJB 3 session bean right?
yes. It is a sessionless bean. Actually, when i set up my annotation as ElementType.TYPE and put it on the class definition then it works.
It does not work if the annotaion is ElementType.METHOD :( -
5. Re: Interceptor Question
pmuir Apr 25, 2007 6:45 AM (in response to xinhua)IIRC method level seam-interceptors aren't supported in Seam atm (JBSEAM-29) - you'll need to use plain EJB3 interceptors (which do support method level interceptors)
-
6. Re: Interceptor Question
xinhua Apr 25, 2007 7:00 AM (in response to xinhua)"petemuir" wrote:
IIRC method level seam-interceptors aren't supported in Seam atm (JBSEAM-29) - you'll need to use plain EJB3 interceptors (which do support method level interceptors)
Oh, that is pity....
standard ejb3 interceptor way @intercpetors(....class) is very urgly. That is why i want to use my own annotation.
hm...seems like i must use isAnnotationPresent(Printout.class) to reflect the beans . ....:(