Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346027 - jetty-7 in OSGi should support fragment-xml and annotations
Summary: jetty-7 in OSGi should support fragment-xml and annotations
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: osgi (show other bugs)
Version: 7.4.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.4.x   Edit
Assignee: Hugues Malphettes CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 01:13 EDT by Hugues Malphettes CLA
Modified: 2011-05-18 03:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hugues Malphettes CLA 2011-05-17 01:13:52 EDT
A few of the servlet-3.0 features are actually already available in jetty-7 although it uses servlet-2.5.
This includes the support for web-fragment.xml and some of the servlet-3.0 annotations.

This bug keeps track of the support for those features in jetty-7-osgi.

Note that none of the support for those features is specified in the OSGi entreprise spec.
So everyone is welcome to comment on how we are supporting those features in OSGi.

In J2EE, web-fragment.xml and annotations are scanned in the WEB-INF/classes and WEB-INF/lib folder.
In OSGi we suggest to scan them in the J2EE locations and add those locations:
1- OSGi fragment bundles hosted by the web-bundle.
2- Required-Bundles that have the attribute jetty-web=true
They are both scanned for the web-fragment.xml and the servlet annotations
3- For annotations only: Import-Packages that have the attribute jetty-web=true

This support will be developed in jetty-7. It is then merged in jetty-8.
Comment 1 Hugues Malphettes CLA 2011-05-18 01:04:33 EDT
Support for osgi fragment bundles that contain META-INF/web-fragment.xml and META-INF/resources is committed.

The latest version of OSGi implemented by equinox supports a new API to introspect the dependencies of a bundle (the package org.osgi.framework.wiring). It would allow us to cleanly get the import packages required bundles and other info for a web-bundle.
However it is not supported by felix.

I think we need to parse the manifest headers we are interested in ourselves.
Comment 2 Hugues Malphettes CLA 2011-05-18 01:51:45 EDT
It is in fact not possible to define a custom attribute for Require-Bundle and Import-Package.

At the moment, the default behavior is to assume that each required bundle behaves like a jar in WEB-INF/lib: it is looked up for the META-INF/resources, META-INF/*.tld, META-INF/web-fragment.xml, and the annotations are scanned.

This behavior is also applied to the osgi fragments.

If we need a different behavior we could introduce some custom headers in the manifest.
Comment 3 Hugues Malphettes CLA 2011-05-18 03:10:24 EDT
OK in fact annotations in jetty-7 are not discoverable: annotations on a servlet, a filter or a listener that are declared in a web.xml or in a web-fragment.xml are processed. But a class that is annotated to declare a servlet is not discovered. That is the realm of servlet-3.0

So marking this bug as fixed.