1 16 package org.apache.cocoon.matching; 17 18 import org.apache.avalon.framework.configuration.Configurable; 19 import org.apache.avalon.framework.configuration.Configuration; 20 import org.apache.avalon.framework.configuration.ConfigurationException; 21 import org.apache.avalon.framework.parameters.Parameters; 22 23 import org.apache.cocoon.environment.ObjectModelHelper; 24 25 import java.util.Map ; 26 27 39 public class RegexpRequestParameterMatcher extends AbstractRegexpMatcher 40 implements Configurable 41 { 42 private String defaultParam; 43 44 public void configure(Configuration config) throws ConfigurationException { 45 this.defaultParam = config.getChild("parameter-name").getValue(null); 46 } 47 48 protected String getMatchString(Map objectModel, Parameters parameters) { 49 50 String paramName = parameters.getParameter("parameter-name", this.defaultParam); 51 if (paramName == null) { 52 getLogger().warn("No parameter name given. FAILING"); 53 return null; 54 } 55 56 String result = ObjectModelHelper.getRequest(objectModel).getParameter(paramName); 57 if (result == null) { 58 getLogger().debug("Parameter '" + paramName + "' not set."); 59 } 60 61 return result; 62 } 63 } 64 | Popular Tags |