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 41 public class WildcardRequestParameterMatcher extends AbstractWildcardMatcher 42 implements Configurable 43 { 44 private String defaultParam; 45 46 public void configure(Configuration config) throws ConfigurationException { 47 this.defaultParam = config.getChild("parameter-name").getValue(null); 48 } 49 50 protected String getMatchString(Map objectModel, Parameters parameters) { 51 52 String paramName = parameters.getParameter("parameter-name", this.defaultParam); 53 if (paramName == null) { 54 getLogger().warn("No parameter name given. FAILING"); 55 return null; 56 } 57 58 String result = ObjectModelHelper.getRequest(objectModel).getParameter(paramName); 59 if (result == null) { 60 getLogger().debug("Parameter '" + paramName + "' not set."); 61 } 62 63 return result; 64 } 65 } 66 | Popular Tags |