...
The OSGi plugins defines the osgi
interceptor and osgiStack
(defaultStack
plus the osgi
interceptor) in the package osgi-default
. This interceptor will check the action and if it implements org.apache.struts2.osgi.interceptor.BundleContextAware
, it will invoke setBundleContext(BundleContext bundleContext) on the action, passing the BundleContext of the OSGi container. The interceptor also checks if the class implements one or many org.apache.struts2.osgi.interceptor.ServiceAware<T>
interfaces, and for each one, it will call , if it does, setServices(List<T> services) will be called, where T is the type of a service published in the OSGi container. For example, lets assume an installed bundle publishes a service with the interface BookPriceLookup
, to get all the instances of this service, an action would look like:
...