Package org.wicketstuff.osgi
Class OsgiWebApplicationFactory
- java.lang.Object
-
- org.wicketstuff.osgi.OsgiWebApplicationFactory
-
- All Implemented Interfaces:
IWebApplicationFactory
public class OsgiWebApplicationFactory extends Object implements IWebApplicationFactory
AnIWebApplicationFactory
which looks up aWebApplication
from the OSGi service registry.In an OSGi context, classes from client bundles cannot be loaded by name in general. This factory loads a
WebApplication
service from the OSGi service registry, using a property with keyAPPLICATION_NAME_KEY
for disambiguation.To bootstrap your Wicket Application when running under OSGi, configure the
WicketFilter
in yourweb.xml
deployment descriptor as follows:<filter> <filter-name>Wicket</filter-name> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> <init-param> <param-name>applicationFactoryClassName</param-name> <param-value>org.wicketstuff.osgi.OsgiWebApplicationFactory</param-value> </init-param> <init-param> <param-name>wicket.osgi.application.name</param-name> <param-value>someUniqueApplicationName</param-value> </init-param> </filter>
The implementation uses a ServiceTracker waiting for a given period for the service to become available.You need to register your
WebApplication
class in the OSGi service registry by any method of your choice, e.g. programmatically in aBundleActivator
, or using Declarative Services or Blueprint.- Author:
- Harald Wellmann
-
-
Field Summary
Fields Modifier and Type Field Description static String
APPLICATION_NAME_KEY
-
Constructor Summary
Constructors Constructor Description OsgiWebApplicationFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebApplication
createApplication(WicketFilter filter)
void
destroy(WicketFilter filter)
-
-
-
Field Detail
-
APPLICATION_NAME_KEY
public static final String APPLICATION_NAME_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
createApplication
public WebApplication createApplication(WicketFilter filter)
- Specified by:
createApplication
in interfaceIWebApplicationFactory
-
destroy
public void destroy(WicketFilter filter)
- Specified by:
destroy
in interfaceIWebApplicationFactory
-
-