...
- Deploy
org.apache.felix.http.proxy
jar file inside the web applicaiton (WEB-INF/lib). - In a startup listener (like ServletContextListener) set the BundleContext as a servlet context attribute (see example).
- Define
org.apache.felix.http.proxy.ProxyServlet
inside yourweb.xml
and register it to serve on all requests/*
(see example). - Define
org.apache.felix.http.proxy.ProxyListener
as a<listener>
in yourweb.xml
to allow HTTP Session related events to be forwarded (see the section of Servlet API Event forwarding below and example). - Be sure to add
javax.servlet;javax.servlet.http;version=2.5
to OSGi system packages ((org.osgi.framework.system.packages
). - Deploy
org.apache.felix.http.bridge
(ororg.apache.felix.http.bundle
) inside the OSGi framework.
...
org.apache.felix.http.jettyEnabled
- True to enable jetty as the http container. The default isfalse
.org.apache.felix.http.whiteboardEnabled
- True to enable the whiteboard implementation. The default isfalse
.
Servlet API Events
The Servlet API defines a number of EventListener
interfaces to catch Servlet API related events. As of HTTP Service 2.1.0 most events generated by the servlet container are forwarded to interested service. To be registered to receive events services must be registered with the respective EventListener
interface:
Interface | Description |
---|---|
| Events on servlet context attribute addition, change and removal. |
| Events on request attribute addition, change and removal. |
| Events on request start and end. |
| Events on session attribute addition, change and removal. To receive such events in a bridged environment, the |
| Events on session creation and destroyal. To receive such events in a bridged environment, the |
Of the defined EventListener
interfaces in the Servlet API, the javax.servlet.ServletContextListener
events are actually not support. For one thing they do not make much sense in an OSGi environment. On the other hand they are hard to capture and propagate. For example in a bridged environment the contextInitialized
event may be sent before the framework and any of the contained bundles are actually ready to act. Likewise the contextDestroyed
event may come to late.
Examples
A set of simple examples illustrating the various features are available.
...