BundleContext in Web Application

Getting the BundleContext (and with it access to the OSGi container and services) in a normal Java web application is possible in multiple ways: