Changeset 3013 for trunk/src/main
- Timestamp:
- 17/08/07 10:56:07 (5 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/java/org/sarugo/xtc/tag/AbstractTagLibrary.java
r2915 r3013 18 18 import java.lang.reflect.Method; 19 19 import java.net.URL; 20 import java.util.ArrayList; 20 21 import java.util.HashMap; 22 import java.util.List; 21 23 import java.util.Map; 24 import java.util.logging.Logger; 22 25 23 26 import javax.el.ELException; … … 33 36 */ 34 37 public abstract class AbstractTagLibrary implements TagLibrary { 38 39 private static Logger LOG = Logger.getLogger("xtc.compiler"); 35 40 36 41 private static class HandlerFactory implements TagHandlerFactory { … … 78 83 } 79 84 80 private final Map factories;81 82 private final Stringnamespace;83 84 private final Map functions;85 private final Map<String, TagHandlerFactory> factories; 86 87 private final List<String> namespace; 88 89 private final Map<String, Method> functions; 85 90 86 91 public AbstractTagLibrary(String namespace) { 87 this.namespace = namespace; 88 this.factories = new HashMap(); 89 this.functions = new HashMap(); 92 this.namespace = new ArrayList<String>(); 93 this.namespace.add(namespace); 94 this.factories = new HashMap<String, TagHandlerFactory>(); 95 this.functions = new HashMap<String, Method>(); 96 } 97 98 protected void addNamespaceAlias(String namespace) { 99 this.namespace.add(namespace); 90 100 } 91 101 … … 130 140 131 141 public boolean containsNamespace(String ns) { 132 return this.namespace.equals(ns); 142 boolean contained = this.namespace.get(0).equals(ns); 143 if (!contained && this.namespace.contains(ns)) { 144 LOG.warning("Use of deprecated namespace: " + ns); 145 contained = true; 146 } 147 return contained; 133 148 } 134 149 135 150 public boolean containsTagHandler(String ns, String localName) { 136 if ( this.namespace.equals(ns)) {151 if (containsNamespace(ns)) { 137 152 if (this.factories.containsKey(localName)) { 138 153 return true; … … 144 159 public TagHandler createTagHandler(String ns, String localName, 145 160 TagConfig tag) throws TemplateException { 146 if ( this.namespace.equals(ns)) {161 if (containsNamespace(ns)) { 147 162 TagHandlerFactory f = (TagHandlerFactory) this.factories 148 163 .get(localName); … … 155 170 156 171 public boolean containsFunction(String ns, String name) { 157 if ( this.namespace.equals(ns)) {172 if (containsNamespace(ns)) { 158 173 return this.functions.containsKey(name); 159 174 } … … 162 177 163 178 public Method createFunction(String ns, String name) { 164 if ( this.namespace.equals(ns)) {179 if (containsNamespace(ns)) { 165 180 return (Method) this.functions.get(name); 166 181 } … … 187 202 188 203 public String getNamespace() { 189 return namespace ;204 return namespace.get(0); 190 205 } 191 206 } trunk/src/main/java/org/sarugo/xtc/tag/jstl/core/JstlCoreLibrary.java
r2975 r3013 19 19 /** 20 20 * @author Jacob Hookom 21 * @ version $Id: JstlCoreLibrary.java,v 1.4 2006/01/07 15:32:07 jhook Exp $21 * @author Michael Terrington 22 22 */ 23 23 public final class JstlCoreLibrary extends AbstractTagLibrary { … … 25 25 public final static String Namespace = "http://java.sun.com/jsp/jstl/core"; 26 26 27 public final static JstlCoreLibrary Instance = new JstlCoreLibrary();28 29 27 public JstlCoreLibrary() { 30 28 super(Namespace); 29 this.addNamespaceAlias("http://java.sun.com/jstl/core"); 31 30 32 31 this.addTagHandler("if", IfHandler.class);
