Fix versions in manifests, fix typo in jetty-osgi-default.xml, ensure Required-TldBundles are on the classpath.

Still doesn't work with version of jsp in jetty-7.6, as the jsp compiler cannot load the class org.glassfish.jsp.api.ResourceInjector, still trying to figure that out.
This commit is contained in:
Jan Bartel 2012-03-09 11:40:52 +11:00
parent c596add40c
commit b77ad34ef0
11 changed files with 146 additions and 65 deletions

View File

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Jetty-OSGi-Jasper integration
Fragment-Host: org.eclipse.jetty.osgi.boot
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot.jsp
Bundle-Version: 7.4.1.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: com.sun.el;resolution:=optional,
@ -22,15 +22,16 @@ Import-Package: com.sun.el;resolution:=optional,
javax.servlet.jsp.resources;version="2.1.0",
javax.servlet.jsp.tagext;version="2.1.0",
javax.servlet.resources;version="2.5.0",
org.apache.jasper;version="2.0.0";resolution:=optional,
org.apache.jasper.compiler;version="2.0.0";resolution:=optional,
org.apache.jasper.compiler.tagplugin;version="2.0.0";resolution:=optional,
org.apache.jasper.runtime;version="2.0.0";resolution:=optional,
org.apache.jasper.security;version="2.0.0";resolution:=optional,
org.apache.jasper.servlet;version="2.0.0";resolution:=optional,
org.apache.jasper.tagplugins.jstl;version="2.0.0";resolution:=optional,
org.apache.jasper.util;version="2.0.0";resolution:=optional,
org.apache.jasper.xmlparser;version="2.0.0";resolution:=optional,
org.apache.jasper;version="6.0.0";resolution:=optional,
org.apache.jasper.compiler;version="6.0.0";resolution:=optional,
org.apache.jasper.compiler.tagplugin;version="6.0.0";resolution:=optional,
org.apache.jasper.runtime;version="6.0.0";resolution:=optional,
org.apache.jasper.security;version="6.0.0";resolution:=optional,
org.apache.jasper.servlet;version="6.0.0";resolution:=optional,
org.apache.jasper.tagplugins.jstl;version="6.0.0";resolution:=optional,
org.apache.jasper.util;version="6.0.0";resolution:=optional,
org.apache.jasper.xmlparser;version="6.0.0";resolution:=optional,
org.glassfish.jasper.api;version="2.1.3";resolution:=optional,
org.apache.taglibs.standard;version="1.2.0";resolution:=optional,
org.apache.taglibs.standard.extra.spath;version="1.2.0";resolution:=optional,
org.apache.taglibs.standard.functions;version="1.2.0";resolution:=optional,

View File

@ -167,6 +167,8 @@ public class WebappRegistrationCustomizerImpl implements WebappRegistrationCusto
}
return urls.toArray(new URL[urls.size()]);
}
/**
* Jasper resolves the dtd when it parses a taglib descriptor.
@ -182,7 +184,7 @@ public class WebappRegistrationCustomizerImpl implements WebappRegistrationCusto
* on a static friendly field :(
* </p>
*/
void fixupDtdResolution()
void fixupDtdResolution()
{
try
{
@ -214,12 +216,12 @@ public class WebappRegistrationCustomizerImpl implements WebappRegistrationCusto
Constants.WEBAPP_DTD_RESOURCE_PATH_22,
Constants.WEBAPP_DTD_RESOURCE_PATH_23, };
// static final String[] CACHED_SCHEMA_RESOURCE_PATHS = {
// Constants.TAGLIB_SCHEMA_RESOURCE_PATH_20,
// Constants.TAGLIB_SCHEMA_RESOURCE_PATH_21,
// Constants.WEBAPP_SCHEMA_RESOURCE_PATH_24,
// Constants.WEBAPP_SCHEMA_RESOURCE_PATH_25,
// };
static final String[] CACHED_SCHEMA_RESOURCE_PATHS = {
Constants.TAGLIB_SCHEMA_RESOURCE_PATH_20,
Constants.TAGLIB_SCHEMA_RESOURCE_PATH_21,
Constants.WEBAPP_SCHEMA_RESOURCE_PATH_24,
Constants.WEBAPP_SCHEMA_RESOURCE_PATH_25,
};
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
{
for (int i = 0; i < CACHED_DTD_PUBLIC_IDS.length; i++)

View File

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Jetty-OSGi-Logback integration
Fragment-Host: org.eclipse.jetty.osgi.boot
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot.logback;singleton:=true
Bundle-Version: 7.3.0.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: ch.qos.logback.classic,

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Support for rfc66 war url scheme
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot.warurl;singleton:=true
Bundle-Version: 7.3.0.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.boot.warurl.WarUrlActivator
Bundle-Vendor: Mort Bay Consulting
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View File

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: Jetty OSGi bootstrap
Bundle-SymbolicName: org.eclipse.jetty.osgi.boot;singleton:=true
Bundle-Vendor: Mort Bay Consulting
Bundle-Version: 7.4.3.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.boot.JettyBootstrapActivator
Import-Package: javax.mail;version="1.4.0";resolution:=optional,
javax.mail.event;version="1.4.0";resolution:=optional,
@ -14,19 +14,19 @@ Import-Package: javax.mail;version="1.4.0";resolution:=optional,
javax.servlet.http;version="2.5.0",
javax.transaction;version="1.1.0";resolution:=optional,
javax.transaction.xa;version="1.1.0";resolution:=optional,
org.eclipse.jetty.deploy;version="7.4.0",
org.eclipse.jetty.deploy.providers;version="7.4.0",
org.eclipse.jetty.http;version="7.4.0",
org.eclipse.jetty.nested;version="7.4.0";resolution:=optional,
org.eclipse.jetty.server;version="7.4.0",
org.eclipse.jetty.server.handler;version="7.4.0",
org.eclipse.jetty.servlet;version="7.4.0",
org.eclipse.jetty.util;version="7.4.0",
org.eclipse.jetty.util.component;version="7.4.0",
org.eclipse.jetty.util.log;version="7.4.0",
org.eclipse.jetty.util.resource;version="7.4.0",
org.eclipse.jetty.webapp;version="7.4.1.v20110513",
org.eclipse.jetty.xml;version="7.4.0",
org.eclipse.jetty.deploy;version="7.6.2",
org.eclipse.jetty.deploy.providers;version="7.6.2",
org.eclipse.jetty.http;version="7.6.2",
org.eclipse.jetty.nested;version="7.6.2";resolution:=optional,
org.eclipse.jetty.server;version="7.6.2",
org.eclipse.jetty.server.handler;version="7.6.2",
org.eclipse.jetty.servlet;version="7.6.2",
org.eclipse.jetty.util;version="7.6.2",
org.eclipse.jetty.util.component;version="7.6.2",
org.eclipse.jetty.util.log;version="7.6.2",
org.eclipse.jetty.util.resource;version="7.6.2",
org.eclipse.jetty.webapp;version="7.6.2",
org.eclipse.jetty.xml;version="7.6.2",
org.osgi.framework,
org.osgi.service.cm;version="1.2.0",
org.osgi.service.packageadmin,
@ -40,7 +40,7 @@ Import-Package: javax.mail;version="1.4.0";resolution:=optional,
org.xml.sax.helpers
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Classpath: .
Export-Package: org.eclipse.jetty.osgi.boot;version="7.4.0",
org.eclipse.jetty.osgi.nested;version="7.4.0",
org.eclipse.jetty.osgi.boot.utils;version="7.4.0"
Export-Package: org.eclipse.jetty.osgi.boot;version="7.6.2",
org.eclipse.jetty.osgi.nested;version="7.6.2",
org.eclipse.jetty.osgi.boot.utils;version="7.6.2"
DynamicImport-Package: org.eclipse.jetty.*;version="[7.3,8)"

View File

@ -22,14 +22,6 @@
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
</New>
<!-- Optional Java 5 bounded threadpool with job queue
<New class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
<Arg name="coreSize" type="int">25</Arg>
<Arg name="maxSize" type="int">50</Arg>
<Arg name="maxIdleMs" type="long">30000</Arg>
</New>
-->
</Set>
@ -118,7 +110,7 @@
contain custom tag libraries (*.tld files)
if those bundles don't exist or can't be loaded no errors or warning will be issued!
this default value is to plug the tld files of the reference implementation of JSF -->
<Set name="tldBundles"><Property name="org.eclipse.jetty.osgi.tldsbundles"
<Set name="tldBundles"><Property name="org.eclipse.jetty.osgi.tldbundles"
default="javax.faces.jsf-impl" /></Set>
</New>
</Arg>

View File

@ -187,6 +187,9 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
{
((WebAppContext)wah).setConfigurationClasses(_configurationClasses);
}
if (_defaultsDescriptor != null)
((WebAppContext)wah).setDefaultsDescriptor(_defaultsDescriptor);
return app.getContextHandler();
}

View File

@ -20,6 +20,7 @@ import java.util.Map;
import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator;
import org.eclipse.jetty.osgi.boot.OSGiServerConstants;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.osgi.boot.internal.serverfactory.DefaultJettyAtJettyHomeHelper;
import org.eclipse.jetty.osgi.boot.internal.serverfactory.IManagedJettyServerRegistry;
import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
import org.eclipse.jetty.server.handler.ContextHandler;
@ -195,7 +196,21 @@ public class JettyContextHandlerServiceTracker implements ServiceListener
String defaultWebXmlPath = (String)sr.getProperty(OSGiWebappConstants.SERVICE_PROP_DEFAULT_WEB_XML_PATH);
if (defaultWebXmlPath == null)
{
defaultWebXmlPath = webapp.getDefaultsDescriptor();
String jettyHome = System.getProperty(DefaultJettyAtJettyHomeHelper.SYS_PROP_JETTY_HOME);
if (jettyHome != null)
{
File etc = new File(jettyHome, "etc");
if (etc.exists() && etc.isDirectory())
{
File webDefault = new File (etc, "webdefault.xml");
if (webDefault.exists())
defaultWebXmlPath = webDefault.getAbsolutePath();
else
defaultWebXmlPath = webapp.getDefaultsDescriptor();
}
else
defaultWebXmlPath = webapp.getDefaultsDescriptor();
}
}
String war = (String)sr.getProperty("war");
try

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
@ -50,6 +51,9 @@ import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.eclipse.jetty.xml.XmlConfiguration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleReference;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
import org.xml.sax.SAXException;
/**
@ -173,6 +177,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
overrideBundleInstallLocation);
File webapp = null;
URL baseWebappInstallURL = null;
if (webappFolderPath != null && webappFolderPath.length() != 0 && !webappFolderPath.equals("."))
{
if (webappFolderPath.startsWith("/") || webappFolderPath.startsWith("file:"))
@ -261,7 +266,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
File defaultWebXml = null;
if (defaultWebXmlPath.startsWith("/") || defaultWebXmlPath.startsWith("file:/"))
{
defaultWebXml = new File(webXmlPath);
defaultWebXml = new File(defaultWebXmlPath);
}
else
{
@ -276,8 +281,9 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
//other parameters that might be defines on the OSGiAppProvider:
context.setParentLoaderPriority(_wrapper.getOSGiAppProvider().isParentLoaderPriority());
configureWebappClassLoader(contributor,context,composite, requireTldBundle);
configureWebAppContext(context,contributor,requireTldBundle);
configureWebappClassLoader(contributor,context,composite);
// @see
// org.eclipse.jetty.webapp.JettyWebXmlConfiguration#configure(WebAppContext)
@ -450,7 +456,7 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
//the actual registration must happen via the new Deployment API.
// _ctxtHandler.addHandler(context);
configureWebappClassLoader(contributor,context,composite);
configureWebappClassLoader(contributor,context,composite, requireTldBundle);
if (context instanceof WebAppContext)
{
webAppContext = (WebAppContext)context;
@ -615,8 +621,9 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
}
while (tldEnum.hasMoreElements())
{
URL tldUrl = tldEnum.nextElement();
tldfrags.add(Resource.newResource(
DefaultFileLocatorHelper.getLocalURL(tldEnum.nextElement())));
DefaultFileLocatorHelper.getLocalURL(tldUrl)));
}
}
}
@ -764,13 +771,17 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
* @param classInBundle
* @throws Exception
*/
protected void configureWebappClassLoader(Bundle contributor, ContextHandler context, OSGiWebappClassLoader webappClassLoader) throws Exception
protected void configureWebappClassLoader(Bundle contributor, ContextHandler context, OSGiWebappClassLoader webappClassLoader, String requireTldBundle) throws Exception
{
if (context instanceof WebAppContext)
{
WebAppContext webappCtxt = (WebAppContext)context;
context.setClassLoader(webappClassLoader);
webappClassLoader.setWebappContext(webappCtxt);
String pathsToRequiredBundles = getPathsToRequiredBundles(context, requireTldBundle);
if (pathsToRequiredBundles != null)
webappClassLoader.addClassPath(pathsToRequiredBundles);
}
else
{
@ -788,6 +799,18 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
// know.
OSGiWebappClassLoader webappClassLoader = new OSGiWebappClassLoader(
_wrapper.getParentClassLoaderForWebapps(),new WebAppContext(),contributor,BUNDLE_CLASS_LOADER_HELPER);
/* DEBUG
try {
Class c = webappClassLoader.loadClass("org.glassfish.jsp.api.ResourceInjector");
System.err.println("LOADED org.glassfish.jsp.api.ResourceInjector from "+c.getClassLoader());
}
catch (Exception e) {e.printStackTrace();}
try {
Class c = webappClassLoader.loadClass("org.apache.jasper.xmlparser.ParserUtils");
System.err.println("LOADED org.apache.jasper.xmlparser.ParserUtils from "+c.getClassLoader());
}
catch (Exception e) {e.printStackTrace();}
*/
return webappClassLoader;
}
@ -811,5 +834,50 @@ public class WebBundleDeployerHelper implements IWebBundleDeployerHelper
}
}
private String getPathsToRequiredBundles (ContextHandler context, String requireTldBundle) throws Exception
{
if (requireTldBundle == null)
return null;
StringBuilder paths = new StringBuilder();
Bundle bundle = (Bundle)context.getAttribute(OSGiWebappConstants.JETTY_OSGI_BUNDLE);
PackageAdmin packAdmin = getBundleAdmin();
DefaultFileLocatorHelper fileLocatorHelper = new DefaultFileLocatorHelper();
String[] symbNames = requireTldBundle.split(", ");
for (String symbName : symbNames)
{
Bundle[] bs = packAdmin.getBundles(symbName, null);
if (bs == null || bs.length == 0)
{
throw new IllegalArgumentException("Unable to locate the bundle '"
+ symbName + "' specified in the "
+ OSGiWebappConstants.REQUIRE_TLD_BUNDLE
+ " of the manifest of "
+ bundle.getSymbolicName());
}
File f = fileLocatorHelper.getBundleInstallLocation(bs[0]);
if (paths.length() > 0)
paths.append(", ");
System.err.println("getPathsToRequiredBundles: bundle path="+bs[0].getLocation()+" uri="+f.toURI());
paths.append(f.toURI().toURL().toString());
}
return paths.toString();
}
private PackageAdmin getBundleAdmin()
{
Bundle bootBundle = ((BundleReference)OSGiWebappConstants.class.getClassLoader()).getBundle();
ServiceTracker serviceTracker = new ServiceTracker(bootBundle.getBundleContext(), PackageAdmin.class.getName(), null);
serviceTracker.open();
return (PackageAdmin) serviceTracker.getService();
}
}

View File

@ -3,20 +3,20 @@ Bundle-ManifestVersion: 2
Bundle-Name: Console
Bundle-SymbolicName: org.eclipse.jetty.osgi.equinoxtools
Bundle-Description: Example application: equinox console accesssible on the web
Bundle-Version: 7.4.2.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Activator: org.eclipse.jetty.osgi.equinoxtools.WebEquinoxToolsActivator
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
org.eclipse.jetty.continuation;version="7.4.0",
org.eclipse.jetty.io;version="7.4.0",
org.eclipse.jetty.util;version="7.4.0",
org.eclipse.jetty.util.log;version="7.4.0",
org.eclipse.jetty.websocket;version="7.4.0",
org.eclipse.jetty.continuation;version="7.6.2",
org.eclipse.jetty.io;version="7.6.2",
org.eclipse.jetty.util;version="7.6.2",
org.eclipse.jetty.util.log;version="7.6.2",
org.eclipse.jetty.websocket;version="7.6.2",
org.eclipse.osgi.framework.console;version="1.1.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.http;version="1.2.0",
org.osgi.util.tracker;version="1.3.0"
Export-Package: org.eclipse.jetty.osgi.equinoxtools;x-internal:=true;version="7.4.2",
org.eclipse.jetty.osgi.equinoxtools.console;x-internal:=true;version="7.4.2"
Export-Package: org.eclipse.jetty.osgi.equinoxtools;x-internal:=true;version="7.6.2",
org.eclipse.jetty.osgi.equinoxtools.console;x-internal:=true;version="7.6.2"
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View File

@ -1,16 +1,16 @@
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-SymbolicName: org.eclipse.jetty.osgi.httpservice
Bundle-Version: 7.4.2.qualifier
Bundle-Version: 7.6.2.qualifier
Bundle-Vendor: Mort Bay Consulting
Bundle-Name: OSGi HttpService provided by equinox HttpServiceServlet deployed on jetty
Jetty-ContextFilePath: contexts/httpservice.xml
Import-Package: javax.servlet;version="2.5.0",
javax.servlet.http;version="2.5.0",
org.eclipse.equinox.http.servlet,
org.eclipse.jetty.server;version="7.0.0",
org.eclipse.jetty.server.handler;version="7.0.0",
org.eclipse.jetty.servlet;version="7.4.0",
org.eclipse.jetty.util.component;version="7.0.0"
Export-Package: org.eclipse.jetty.osgi.httpservice;version="7.4.2"
org.eclipse.jetty.server;version="7.6.2",
org.eclipse.jetty.server.handler;version="7.6.2",
org.eclipse.jetty.servlet;version="7.6.2",
org.eclipse.jetty.util.component;version="7.6.2"
Export-Package: org.eclipse.jetty.osgi.httpservice;version="7.6.2"