1 16 17 package org.apache.struts.chain; 18 19 20 import org.apache.commons.chain.Command; 21 import org.apache.commons.chain.Context; 22 import org.apache.struts.config.ForwardConfig; 23 24 25 32 33 public abstract class AbstractPerformForward implements Command { 34 35 36 38 39 private String forwardConfigKey = Constants.FORWARD_CONFIG_KEY; 40 41 private String moduleConfigKey = Constants.MODULE_CONFIG_KEY; 42 43 44 46 47 52 public String getForwardConfigKey() { 53 54 return (this.forwardConfigKey); 55 56 } 57 58 59 66 public void setForwardConfigKey(String forwardConfigKey) { 67 68 this.forwardConfigKey = forwardConfigKey; 69 70 } 71 72 77 public String getModuleConfigKey() { 78 79 return (this.moduleConfigKey); 80 81 } 82 83 84 91 public void setModuleConfigKey(String moduleConfigKey) { 92 93 this.moduleConfigKey = moduleConfigKey; 94 95 } 96 97 98 100 101 109 public boolean execute(Context context) throws Exception { 110 111 ForwardConfig forwardConfig = (ForwardConfig) 113 context.get(getForwardConfigKey()); 114 if (forwardConfig == null) { 115 return (false); 116 } 117 118 perform(context, forwardConfig); 120 return (true); 121 122 } 123 124 125 127 128 135 protected abstract void perform(Context context, 136 ForwardConfig forwardConfig) 137 throws Exception ; 138 139 140 } 141 | Popular Tags |