1 16 package org.apache.cocoon.selection; 17 18 import java.util.Map ; 19 20 import org.apache.avalon.framework.configuration.Configuration; 21 import org.apache.avalon.framework.configuration.ConfigurationException; 22 import org.apache.avalon.framework.parameters.Parameters; 23 import org.apache.cocoon.environment.ObjectModelHelper; 24 25 55 public class RegexpRequestParameterSelector extends AbstractRegexpSelector { 56 57 58 protected String parameterName; 59 60 63 public RegexpRequestParameterSelector() { 64 super(); 65 } 66 67 76 public void configure(Configuration configuration) 77 throws ConfigurationException { 78 super.configure(configuration); 79 this.parameterName = configuration.getChild("parameter-name").getValue(null); 80 } 81 82 90 public Object getSelectorContext(Map objectModel, Parameters parameters) { 91 String name = parameters.getParameter("parameter-name", this.parameterName); 92 if (name == null) { 93 this.getLogger().warn("No parameter name given -- failing."); 94 return null; 95 } 96 return ObjectModelHelper.getRequest(objectModel).getParameter(name); 97 } 98 } 99 | Popular Tags |