Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Feature/Jetty OSGi"

< Jetty‎ | Feature
m
m
Line 38: Line 38:
  
 
This is supported in 2 ways:
 
This is supported in 2 ways:
- The traditional jetty way: locate the jetty.home and add the libs to lib/ext then configure jetty.xml
+
* The traditional jetty way: locate the jetty.home and add the libs to lib/ext then configure jetty.xml
- The OSGi way consists of installing a bundle-fragment hosted by 'org.eclipse.jetty.osgi.boot'
+
* The OSGi way consists of installing a bundle-fragment hosted by 'org.eclipse.jetty.osgi.boot'
 
This will make the dependencies of the fragment available in the classloader of the server.
 
This will make the dependencies of the fragment available in the classloader of the server.
 
In order to hook into the lifecycle of server it is possible to define an implementation of BundleActivator that will be invoked by the bundle 'org.eclipse.jetty.osgi.boot'.
 
In order to hook into the lifecycle of server it is possible to define an implementation of BundleActivator that will be invoked by the bundle 'org.eclipse.jetty.osgi.boot'.
 
In order for this BundleActivator to be invoked it must be named following this convention: ${bundle.id.of.this.fragment}+".FragmentActivator"
 
In order for this BundleActivator to be invoked it must be named following this convention: ${bundle.id.of.this.fragment}+".FragmentActivator"
  
Jetty-osgi is distributed with a number of optional bundles that are example of this technique:
+
Jetty-osgi is distributed with a number of optional bundles that are illustrate this technique:
 
Support for jsp with the bundle "org.eclipse.jetty.osgi.boot.jsp"
 
Support for jsp with the bundle "org.eclipse.jetty.osgi.boot.jsp"
 
Support for centralized logging on logback; "org.eclipse.jetty.osgi.boot.logback"
 
Support for centralized logging on logback; "org.eclipse.jetty.osgi.boot.logback"
  
 
| more = (optional) - links, additional references
 
| more = (optional) - links, additional references
| category = (optional) - categor(ies) to use for this page. If blank, will use the template name as a default category
+
| category = [[Category:Jetty]] [[Category:OSGi]]
Example: [[Category:Category 1]] [[Category:Category 2]]
+
 
}}
 
}}

Revision as of 15:19, 30 November 2009



Introduction

Jetty on OSGi consists of bootstrapping a standard jetty server from OSGi. It supports the deployment of traditional J2EE web-applications as well as web-applications contained inside an OSGi bundle (RFC66).

The goal of Jetty on OSGi is to offer a migration path for traditional J2EE applications to run inside an OSGi container. It favors J2EE applications currently deployed on jetty: developers and IT administrators familiar with a jetty deployment will found the same folder structure and configuration files.

Jetty-on-OSGi also provides an SDK for Eclipse-PDE that supports the development and debugging of a mix of traditional web-applications and web-applications contained in an OSGi bundle: Jetty on OSGi SDK for Eclipse PDE.

Feature

Jetty OSGi bootstrapping

A single bundle 'org.eclipse.jetty.osgi.boot' acts as an alternative to Jetty's Start.jar. It wires up all the jetty jars that can be located. It locates the ${jetty.home} folder where the configuration files are located. It starts a jetty server according to these configuration files:

It locates a ${jetty.home} folder (or generate one by default) and starts a jetty server according to the jetty.xml file.

The classloader inside which the jetty server is executing is a mix of the OSGi classloader provided by the 'org.eclipse.jetty.osgi.boot' bundle and also the jars and folders found inside ${jetty.home}/lib/ext and ${jetty.home}/resources.

The jetty.xml provided by default in jetty will deploy all web-applications found inside the ${jetty.home}/webapps and will read the jetty context files found inside ${jetty.home/contexts}.

Deployment of web-applications via OSGi

Support for RFC66

The OSGi service 'org.eclipse.jetty.server.handler.ContextHandler'

Extensions to RFC66

Architecture

Detailed classloader tree

Injecting new server-wide features into jetty-osgi

A common situation for framework developers is to make a set of library installed in the server's classloader and to have a hook in the life-cycle of the server.

This is supported in 2 ways:

  • The traditional jetty way: locate the jetty.home and add the libs to lib/ext then configure jetty.xml
  • The OSGi way consists of installing a bundle-fragment hosted by 'org.eclipse.jetty.osgi.boot'

This will make the dependencies of the fragment available in the classloader of the server. In order to hook into the lifecycle of server it is possible to define an implementation of BundleActivator that will be invoked by the bundle 'org.eclipse.jetty.osgi.boot'. In order for this BundleActivator to be invoked it must be named following this convention: ${bundle.id.of.this.fragment}+".FragmentActivator"

Jetty-osgi is distributed with a number of optional bundles that are illustrate this technique: Support for jsp with the bundle "org.eclipse.jetty.osgi.boot.jsp" Support for centralized logging on logback; "org.eclipse.jetty.osgi.boot.logback"

Additional Resources

(optional) - links, additional references

Copyright © Eclipse Foundation, Inc. All Rights Reserved.