public class WebBundleDeployerHelper extends Object implements IWebBundleDeployerHelper
This class should be called as a consequence of the activation of a new
service that is a ContextHandler.
This way the new webapps are exposed as OSGi services.
Helper methods to register a bundle that is a web-application or a context.
Limitations:Modifier and Type | Field and Description |
---|---|
static BundleClassLoaderHelper |
BUNDLE_CLASS_LOADER_HELPER
By default set to:
DefaultBundleClassLoaderHelper . |
static BundleFileLocatorHelper |
BUNDLE_FILE_LOCATOR_HELPER
By default set to:
DefaultBundleClassLoaderHelper . |
static Collection<WebappRegistrationCustomizer> |
JSP_REGISTRATION_HELPERS
By default set to:
DefaultBundleClassLoaderHelper . |
INTERNAL_SERVICE_PROP_UNKNOWN_CONTEXT_HANDLER_TYPE
Constructor and Description |
---|
WebBundleDeployerHelper(ServerInstanceWrapper wrapper) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyMetaInfContextXml(org.osgi.framework.Bundle bundle,
ContextHandler contextHandler) |
protected void |
configureWebappClassLoader(org.osgi.framework.Bundle contributor,
ContextHandler context,
OSGiWebappClassLoader webappClassLoader,
String requireTldBundle)
Configure a classloader onto the context.
|
protected void |
configureWebAppContext(ContextHandler wah,
org.osgi.framework.Bundle contributor,
String requireTldBundle)
Applies the properties of WebAppDeployer as defined in jetty.xml.
|
protected ContextHandler |
createContextHandler(ContextHandler handlerToConfigure,
org.osgi.framework.Bundle bundle,
File contextFile,
String extraClasspath,
String overrideBundleInstallLocation,
String requireTldBundle) |
protected ContextHandler |
createContextHandler(ContextHandler handlerToConfigure,
org.osgi.framework.Bundle bundle,
InputStream contextInputStream,
String extraClasspath,
String overrideBundleInstallLocation,
String requireTldBundle) |
protected OSGiWebappClassLoader |
createWebappClassLoader(org.osgi.framework.Bundle contributor)
No matter what the type of webapp, we create a WebappClassLoader.
|
ContextHandler |
registerContext(org.osgi.framework.Bundle contributor,
String contextFileRelativePath,
String extraClasspath,
String overrideBundleInstallLocation,
String requireTldBundle,
ContextHandler handler)
This type of registration relies on jetty's complete context xml file.
|
WebAppContext |
registerWebapplication(org.osgi.framework.Bundle bundle,
String webappFolderPath,
String contextPath,
String extraClasspath,
String overrideBundleInstallLocation,
String requireTldBundle,
String webXmlPath,
String defaultWebXmlPath,
WebAppContext webAppContext)
Deploy a new web application on the jetty server.
|
static void |
staticInit() |
void |
unregister(ContextHandler contextHandler)
Stop a ContextHandler and remove it from the collection.
|
public static BundleClassLoaderHelper BUNDLE_CLASS_LOADER_HELPER
DefaultBundleClassLoaderHelper
. It supports
equinox and apache-felix fragment bundles that are specific to an OSGi
implementation should set a different implementation.public static BundleFileLocatorHelper BUNDLE_FILE_LOCATOR_HELPER
DefaultBundleClassLoaderHelper
. It supports
equinox and apache-felix fragment bundles that are specific to an OSGi
implementation should set a different implementation.public static Collection<WebappRegistrationCustomizer> JSP_REGISTRATION_HELPERS
DefaultBundleClassLoaderHelper
. It supports
equinox and apache-felix fragment bundles that are specific to an OSGi
implementation should set a different implementation.
Several of those objects can be added here: For example we could have an optional fragment that setups a specific implementation of JSF for the whole of jetty-osgi.
public WebBundleDeployerHelper(ServerInstanceWrapper wrapper)
public static void staticInit()
public WebAppContext registerWebapplication(org.osgi.framework.Bundle bundle, String webappFolderPath, String contextPath, String extraClasspath, String overrideBundleInstallLocation, String requireTldBundle, String webXmlPath, String defaultWebXmlPath, WebAppContext webAppContext) throws Exception
registerWebapplication
in interface IWebBundleDeployerHelper
bundle
- The bundlewebappFolderPath
- The path to the root of the webapp. Must be a
path relative to bundle; either an absolute path.contextPath
- The context path. Must start with "/"extraClasspath
- overrideBundleInstallLocation
- requireTldBundle
- The list of bundles's symbolic names that contain
tld files that are required by this WAB.webXmlPath
- defaultWebXmlPath
- TODO: parameter descriptionException
public void unregister(ContextHandler contextHandler) throws Exception
IWebBundleDeployerHelper
unregister
in interface IWebBundleDeployerHelper
Exception
ContextDeployer.undeploy(java.lang.String)
public ContextHandler registerContext(org.osgi.framework.Bundle contributor, String contextFileRelativePath, String extraClasspath, String overrideBundleInstallLocation, String requireTldBundle, ContextHandler handler) throws Exception
IWebBundleDeployerHelper
registerContext
in interface IWebBundleDeployerHelper
requireTldBundle
- The list of bundles'symbolic name that contain
tld files for this webapp.handler
- the context handler passed in the server reference that
will be configured, deployed and started.Exception
protected void configureWebAppContext(ContextHandler wah, org.osgi.framework.Bundle contributor, String requireTldBundle) throws IOException
IOException
around the comment
// configure it
protected ContextHandler createContextHandler(ContextHandler handlerToConfigure, org.osgi.framework.Bundle bundle, File contextFile, String extraClasspath, String overrideBundleInstallLocation, String requireTldBundle)
contextFile
- protected ContextHandler createContextHandler(ContextHandler handlerToConfigure, org.osgi.framework.Bundle bundle, InputStream contextInputStream, String extraClasspath, String overrideBundleInstallLocation, String requireTldBundle)
contextFile
- protected void configureWebappClassLoader(org.osgi.framework.Bundle contributor, ContextHandler context, OSGiWebappClassLoader webappClassLoader, String requireTldBundle) throws Exception
If the context is not a WebAppContext, same but with a simpler URLClassLoader. Note that the URLClassLoader is pretty much fake: it delegate all actual classloading to the parent classloaders.
The URL[] returned by the URLClassLoader create contained specifically the jars that some j2ee tools expect and look into. For example the jars that contain tld files for jasper's jstl support.
Also as the jars in the lib folder and the classes in the classes folder might already be in the OSGi classloader we filter them out of the WebAppClassLoader
context
- contributor
- webapp
- contextPath
- classInBundle
- Exception
protected OSGiWebappClassLoader createWebappClassLoader(org.osgi.framework.Bundle contributor) throws Exception
Exception
protected void applyMetaInfContextXml(org.osgi.framework.Bundle bundle, ContextHandler contextHandler) throws Exception
Exception
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.