2 Replies Latest reply on Jun 19, 2009 8:50 AM by larshuber

    org.jboss.seam.intercept.Interceptor limits the number of Interceptors

    larshuber

      Hi


      Currently this is not working.


      @Interceptors({FirstInterceptor.class, SecondInterceptor.class})
      



      The Interceptor implementation of 2.1 nightly build restricts the @Interceptors annotation to exactly 1 interceptor. The following code shows the cause.



         public Interceptor(Class[] classes, Annotation annotation, Component component) 
         {
            if (classes.length!=1)
            {
               //TODO: remove this silly restriction!
               throw new IllegalArgumentException("Must be exactly one interceptor when used as a meta-annotation");
            }
            userInterceptorClass = classes[0];
      
      




      Will this restriction be removed or what would be an appropriate workaround?


      thanks
      Lars

        • 1. Re: org.jboss.seam.intercept.Interceptor limits the number of Interceptors
          trossmy

          Lars, since this issue is quite old, did u apply a patch or implement some kind of workaround for it?

          • 2. Re: org.jboss.seam.intercept.Interceptor limits the number of Interceptors
            larshuber

            I don't know if it's a workaround or actually standard use. I created for each Interceptor it's own annotation. These annotations you can put on your classes instead of @Interceptors(...) directly.




            @Target({ ElementType.TYPE })
            @Retention(RetentionPolicy.RUNTIME)
            @Documented
            @Inherited
            @Interceptors(ServiceExceptionInterceptor.class)
            public @interface ServiceException {
            }
            





            @Target({ ElementType.TYPE })
            @Retention(RetentionPolicy.RUNTIME)
            @Documented
            @Inherited
            @Interceptors(ServiceSecurityInterceptor.class)
            public @interface ServiceSecurity {
            }
            





            @ServiceSecurity
            @ServiceException
            public class BaseService implements Serializable {
            }