1 16 package org.directwebremoting.impl; 17 18 import java.util.ArrayList ; 19 import java.util.Collections ; 20 import java.util.HashMap ; 21 import java.util.Iterator ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 import org.directwebremoting.AjaxFilter; 26 import org.directwebremoting.extend.AjaxFilterManager; 27 28 32 public class DefaultAjaxFilterManager implements AjaxFilterManager 33 { 34 37 public Iterator getAjaxFilters(String scriptname) 38 { 39 List reply = new ArrayList (); 41 42 reply.addAll(global); 43 44 List classBased = (List ) classBasedMap.get(scriptname); 45 if (classBased != null) 46 { 47 reply.addAll(classBased); 48 } 49 50 reply.add(executor); 51 52 return Collections.unmodifiableList(reply).iterator(); 53 } 54 55 58 public void addAjaxFilter(AjaxFilter filter) 59 { 60 global.add(filter); 61 } 62 63 66 public void addAjaxFilter(AjaxFilter filter, String scriptname) 67 { 68 List classBased = (List ) classBasedMap.get(scriptname); 69 if (classBased == null) 70 { 71 classBased = new ArrayList (); 72 classBasedMap.put(scriptname, classBased); 73 } 74 75 classBased.add(filter); 76 } 77 78 81 private AjaxFilter executor = new ExecuteAjaxFilter(); 82 83 86 private List global = new ArrayList (); 87 88 91 private Map classBasedMap = new HashMap (); 92 } 93 | Popular Tags |