1 package org.apache.turbine.pipeline; 2 3 56 57 import java.io.IOException ; 58 import org.apache.turbine.Turbine; 59 import org.apache.turbine.RunData; 60 import org.apache.turbine.TurbineException; 61 import org.apache.turbine.ValveContext; 62 import org.apache.commons.logging.Log; 63 import org.apache.commons.logging.LogFactory; 64 65 76 public class DetermineTargetValve 77 extends AbstractValve 78 { 79 private static final Log log 80 = LogFactory.getLog( DetermineTargetValve.class ); 81 82 85 public void invoke( RunData data, ValveContext context ) 86 throws IOException , TurbineException 87 { 88 if ( ! data.hasTarget() ) 89 { 90 String target = data.getParameters().getString( "template" ); 91 92 if ( target != null ) 93 { 94 data.setTarget( target ); 95 96 log.debug( "Set target from request parameter" ); 97 } 98 else 99 { 100 data.setTarget( Turbine.getConfiguration().getString( 101 Turbine.TEMPLATE_HOMEPAGE ) ); 102 103 log.debug( "Set target using default value" ); 104 } 105 } 106 107 if ( log.isDebugEnabled() ) 108 { 109 log.debug( "Target is now: " + data.getTarget() ); 110 } 111 112 context.invokeNext( data ); 114 } 115 } 116 | Popular Tags |