public class OsgiWebApplicationFactory extends Object implements org.apache.wicket.protocol.http.IWebApplicationFactory
IWebApplicationFactory
which looks up a WebApplication
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 key
APPLICATION_NAME_KEY
for disambiguation.
To bootstrap your Wicket Application when running under OSGi, configure the WicketFilter
in your web.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 a BundleActivator
, or using Declarative Services
or Blueprint.
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_NAME_KEY |
Constructor and Description |
---|
OsgiWebApplicationFactory() |
Modifier and Type | Method and Description |
---|---|
org.apache.wicket.protocol.http.WebApplication |
createApplication(org.apache.wicket.protocol.http.WicketFilter filter) |
void |
destroy(org.apache.wicket.protocol.http.WicketFilter filter) |
public static final String APPLICATION_NAME_KEY
public org.apache.wicket.protocol.http.WebApplication createApplication(org.apache.wicket.protocol.http.WicketFilter filter)
createApplication
in interface org.apache.wicket.protocol.http.IWebApplicationFactory
public void destroy(org.apache.wicket.protocol.http.WicketFilter filter)
destroy
in interface org.apache.wicket.protocol.http.IWebApplicationFactory
Copyright © 2015. All rights reserved.