1 16 package org.apache.cocoon.ajax; 17 18 import java.util.Map ; 19 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.avalon.framework.thread.ThreadSafe; 22 import org.apache.cocoon.environment.ObjectModelHelper; 23 import org.apache.cocoon.environment.Request; 24 import org.apache.cocoon.selection.AbstractSwitchSelector; 25 import org.apache.commons.lang.BooleanUtils; 26 27 45 public class AjaxRequestSelector extends AbstractSwitchSelector implements ThreadSafe { 46 47 public Object getSelectorContext(Map objectModel, Parameters parameters) { 48 Request req = ObjectModelHelper.getRequest(objectModel); 49 return BooleanUtils.toBooleanObject(AjaxHelper.isAjaxRequest(req)); 50 } 51 52 public boolean select(String expression, Object selectorContext) { 53 boolean test = BooleanUtils.toBoolean(expression); 54 55 return test == ((Boolean )selectorContext).booleanValue(); 56 } 57 } 58 | Popular Tags |