public void addInterceptor(Object interceptorInstance) { try { addInterceptor(new Interceptor(interceptorInstance, this)); } catch (NoClassDefFoundError e) { log.debug("Unable to load interceptor " + interceptorInstance.getClass(), e); } catch (TypeNotPresentException e) { log.debug("Unable to load interceptor " + interceptorInstance.getClass(), e); } catch (Exception e) { throw new IllegalArgumentException("Unable to load interceptor " + interceptorInstance.getClass(), e); } }
private void initInterceptors() { initDefaultInterceptors(); for ( Annotation annotation: getBeanClass().getAnnotations() ) { if ( annotation.annotationType().isAnnotationPresent(INTERCEPTORS) ) { Class[] classes = value( annotation.annotationType().getAnnotation(INTERCEPTORS) ); addInterceptor( new Interceptor(classes, annotation, this) ); } if ( annotation.annotationType().isAnnotationPresent(Interceptors.class) ) { Class[] classes = annotation.annotationType().getAnnotation(Interceptors.class).value(); addInterceptor( new Interceptor(classes, annotation, this) ); } } newSort(interceptors); newSort(clientSideInterceptors); if ( log.isDebugEnabled() ) log.debug("interceptor stack: " + interceptors); }
public void registered(InjectorFactory factory) { // Wrap the Resteasy PropertyInjectorImpl in a Seam interceptor (for @Context injection) seamComponent.addInterceptor( new ResteasyContextInjectionInterceptor( new PropertyInjectorImpl(getScannableClass(), providerFactory) ) ); // NOTE: Adding an interceptor to Component at this stage means that the interceptor is // always executed last in the chain. The sorting of interceptors of a Component occurs // only when the Component metadata is instantiated. This is OK in this case, as the // JAX RS @Context injection can occur last after all other interceptors executed. }
addInterceptor(interceptorInstance);