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.commons.chain.web.WebContext; 23 import org.apache.struts.config.ModuleConfig; 24 25 26 33 34 public abstract class AbstractPerformInclude implements Command { 35 36 37 39 40 private String includeKey = Constants.INCLUDE_KEY; 41 private String moduleConfigKey = Constants.MODULE_CONFIG_KEY; 42 43 44 46 47 52 public String getIncludeKey() { 53 54 return (this.includeKey); 55 56 } 57 58 59 66 public void setIncludeKey(String includeKey) { 67 68 this.includeKey = includeKey; 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 WebContext wcontext = (WebContext) context; 113 ModuleConfig moduleConfig = (ModuleConfig) 114 wcontext.get(getModuleConfigKey()); 115 116 String include = (String ) 118 context.get(getIncludeKey()); 119 if (include == null) { 120 return (false); 121 } 122 123 String uri = moduleConfig.getPrefix() + include; 125 126 perform(context, uri); 128 return (true); 129 130 } 131 132 133 135 136 143 protected abstract void perform(Context context, 144 String include) 145 throws Exception ; 146 147 148 } 149 | Popular Tags |