1 18 package org.apache.beehive.netui.pageflow.interceptor.action; 19 20 import org.apache.beehive.netui.pageflow.interceptor.InterceptorException; 21 import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain; 22 23 import java.net.URI ; 24 import java.net.URISyntaxException ; 25 26 class SimpleActionInterceptor 27 extends ActionInterceptor 28 { 29 public SimpleActionInterceptor( SimpleActionInterceptorConfig config ) 30 { 31 init( config ); 32 } 33 34 public void preAction( ActionInterceptorContext context, InterceptorChain chain ) 35 throws InterceptorException 36 { 37 if ( ! getActionInterceptorConfig().isAfterAction() ) doit( context, chain ); 38 } 39 40 public void postAction( ActionInterceptorContext context, InterceptorChain chain ) 41 throws InterceptorException 42 { 43 if ( getActionInterceptorConfig().isAfterAction() ) doit( context, chain ); 44 } 45 46 private void doit( ActionInterceptorContext context, InterceptorChain chain ) 47 throws InterceptorException 48 { 49 try 50 { 51 String path = getActionInterceptorConfig().getPath(); 52 setOverrideForward( new InterceptorForward( new URI ( path ) ), context ); 53 chain.continueChain(); 54 } 55 catch ( URISyntaxException e ) 56 { 57 throw new InterceptorException( e ); 58 } 59 } 60 61 public void afterNestedIntercept( AfterNestedInterceptContext context ) throws InterceptorException 62 { 63 } 64 65 public SimpleActionInterceptorConfig getActionInterceptorConfig() 66 { 67 return ( SimpleActionInterceptorConfig ) super.getConfig(); 68 } 69 } 70 | Popular Tags |