users@glassfish.java.net

Re: Interceptor

From: <forums_at_java.net>
Date: Mon, 23 May 2011 07:40:07 -0500 (CDT)

 The Interceptor no works as example above. I worked with Interceptor, but
not custom annotation.

1 - this work normaly:

    @Interceptor
    public class TestInterceptor {

        @PostConstruct
        public Object businessIntercept(InvocationContext ctx) {
            System.out.println("INTERCEPTOR @PostConstruct: " +
ctx.getTarget().getClass().getName());
        }
    }

    @Singleton     @Interceptors(TesteInterceptor.class)      public
class TestBusiness {}  
2 - this not work:

      @Target(value={ElementType.TYPE})
      @Retention(value=RetentionPolicy.RUNTIME)
      public @interface @TestInterceptorAnnotation {}

      @Interceptor
      public class TestInterceptor { 

      @PostConstruct
      public Object businessIntercept(InvocationContext ctx) {
            System.out.println("INTERCEPTOR @PostConstruct: " +
ctx.getTarget().getClass().getName());
      }
 

      @Singleton
      @TestInterceptorAnnotation
       public class TestBusiness {}

3 -  this not work:

       @SOAPBinding        @Target(value={ElementType.TYPE})
       @Retention(value=RetentionPolicy.RUNTIME)
       public @interface @TestInterceptorAnnotation {}
 

       @Interceptor @TestInterceptorAnnotation
        public class TestInterceptor {

                @PostConstruct
                public Object businessIntercept(InvocationContext
ctx) {
                       System.out.println("INTERCEPTOR
@PostConstruct: " + ctx.getTarget().getClass().getName());
                }
          }

         @Singleton
         @TestInterceptorAnnotation
         public class TestBusiness {}

 

         implementation 2 and 3 not work in Glassfish 3.1, this is
allowed?  what is wrong?

 

 


--
[Message sent by forum member 'helbert']
View Post: http://forums.java.net/node/804680