1 package org.tigris.scarab.pipeline; 2 3 48 49 import java.io.IOException ; 50 51 import org.apache.fulcrum.parser.ParameterParser; 52 import org.apache.turbine.RunData; 53 import org.apache.turbine.Turbine; 54 import org.apache.turbine.TurbineException; 55 import org.apache.turbine.ValveContext; 56 import org.apache.turbine.pipeline.AbstractValve; 57 import org.tigris.scarab.util.Log; 58 59 65 public class DetermineTargetValve 66 extends AbstractValve 67 { 68 71 public void invoke(RunData data, ValveContext context) 72 throws IOException , TurbineException 73 { 74 ParameterParser parameters = data.getParameters(); 75 if (! data.hasTarget()) 76 { 77 String target = parameters.getString("template"); 78 79 if (target != null) 80 { 81 data.setTarget(target); 82 Log.get().debug("Set target from request parameter"); 83 } 84 else if (parameters.getString("id") != null) 85 { 86 data.setTarget("ViewIssue.vm"); 87 } 88 else 89 { 90 data.setTarget(Turbine.getConfiguration().getString( 91 Turbine.TEMPLATE_HOMEPAGE)); 92 Log.get().debug("Set target using default value"); 93 } 94 } 95 96 if (Log.get().isDebugEnabled()) 97 { 98 Log.get().debug("Target is now: " + data.getTarget()); 99 } 100 101 context.invokeNext(data); 103 } 104 } 105 | Popular Tags |