1 11 package org.eclipse.equinox.jsp.jasper.registry; 12 13 import java.util.Hashtable ; 14 import org.eclipse.core.runtime.*; 15 import org.eclipse.equinox.internal.jsp.jasper.registry.Activator; 16 import org.eclipse.equinox.jsp.jasper.JspServlet; 17 import org.osgi.framework.Bundle; 18 19 30 public class JSPFactory implements IExecutableExtensionFactory, IExecutableExtension { 31 32 private IConfigurationElement config; 33 private String bundleResourcePath; 34 35 public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { 36 this.config = config; 37 if (data != null) { 38 if (data instanceof String ) 39 bundleResourcePath = (String ) data; 40 else if (data instanceof Hashtable ) { 41 bundleResourcePath = (String ) ((Hashtable ) data).get("path"); } 43 } 44 } 45 46 public Object create() throws CoreException { 47 Bundle b = Activator.getBundle(config.getContributor().getName()); String alias = config.getAttribute("alias"); if (alias != null && alias.indexOf("/*.") == alias.lastIndexOf('/')) { alias = alias.substring(0, alias.lastIndexOf('/')); 51 if (alias.length() == 0) 52 alias = "/"; } 54 return new JspServlet(b, bundleResourcePath, alias); 55 } 56 } 57 | Popular Tags |