1 16 package org.apache.cocoon.selection; 17 18 import org.apache.avalon.framework.configuration.Configuration; 19 import org.apache.avalon.framework.configuration.ConfigurationException; 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.cocoon.environment.ObjectModelHelper; 22 23 import java.util.Map ; 24 25 51 52 public class HostSelector extends NamedPatternsSelector { 53 54 public void configure(Configuration conf) throws ConfigurationException { 55 configure(conf, "host", "name", "value"); 56 } 57 58 public boolean select(String expression, Map objectModel, Parameters parameters) { 59 ObjectModelHelper.getResponse(objectModel).addHeader("Vary", "Host"); 61 62 String host = ObjectModelHelper.getRequest(objectModel).getHeader("Host"); 64 if (host == null) { 65 getLogger().debug("No Host header -- failing."); 66 return false; 67 } 68 69 return checkPatterns(expression, host); 70 } 71 } 72 | Popular Tags |