1 18 package org.apache.beehive.netui.pageflow.interceptor; 19 20 21 import java.util.List ; 22 23 public class Interceptors 24 { 25 public static void doPreIntercept( InterceptorContext context, List interceptors ) 26 throws InterceptorException 27 { 28 if ( interceptors != null ) 29 { 30 PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain( context, interceptors ); 31 chain.continueChain(); 32 } 33 } 34 35 public static void doPostIntercept( InterceptorContext context, List interceptors ) 36 throws InterceptorException 37 { 38 if ( interceptors != null ) 39 { 40 PostInvokeInterceptorChain chain = new PostInvokeInterceptorChain( context, interceptors ); 41 chain.continueChain(); 42 } 43 } 44 45 private static final class PreInvokeInterceptorChain 46 extends InterceptorChain 47 { 48 public PreInvokeInterceptorChain( InterceptorContext context, List interceptors ) 49 { 50 super( context, interceptors ); 51 } 52 53 protected Object invoke( Interceptor interceptor ) 54 throws InterceptorException 55 { 56 interceptor.preInvoke( getContext(), this ); 57 return null; 58 } 59 } 60 61 private static final class PostInvokeInterceptorChain 62 extends InterceptorChain 63 { 64 public PostInvokeInterceptorChain( InterceptorContext context, List interceptors ) 65 { 66 super( context, interceptors ); 67 } 68 69 protected Object invoke( Interceptor interceptor ) 70 throws InterceptorException 71 { 72 interceptor.postInvoke( getContext(), this ); 73 return null; 74 } 75 } 76 } 77 | Popular Tags |