ServiceReference<WebContainer> webContainerReference = null;
do{
webContainerReference = context.getServiceReference(WebContainer.class);
} while(webContainerReference == null);
WebContainer webContainer = context.getService(webContainerReference);
SharedWebContainerContext httpContext = webContainer.getDefaultSharedHttpContext();
Dictionary<String, String> properties = new Hashtable<String, String>();
properties.put("httpContext.id", "shared");
properties.put("httpContext.shared", "true");
httpContextRegistration = context.registerService(HttpContext.class, httpContext, properties);
LoginServlet loginServlet = new LoginServlet();
properties.put(SERVLET_NAME_PROPERTY, LOGIN_SERVLET_NAME);
loginUiRegistration = context.registerService(HttpServlet.class, loginServlet, properties);
#... and so on, setting up a ServiceTracker which registers Filters for detected Servlets
karaf@root()> log:display2015-12-17 13:08:23,167 | INFO | Thread-34 | BundleWatcherImpl | 24 - org.apache.karaf.bundle.core - 4.0.3 | [Watch] Updating watched bundle: web.login (0.0.1.BUILD-201512171220)2015-12-17 13:08:23,201 | INFO | Thread-34 | HttpServiceFactoryImpl | 163 - org.ops4j.pax.web.pax-web-runtime - 4.2.3 | Unbinding bundle: [web.login [272]]2015-12-17 13:08:23,232 | INFO | Thread-34 | HttpServiceFactoryImpl | 163 - org.ops4j.pax.web.pax-web-runtime - 4.2.3 | Binding bundle: [web.login [272]] to http service2015-12-17 13:08:23,245 | WARN | Thread-34 | HttpServiceStopped | 163 - org.ops4j.pax.web.pax-web-runtime - 4.2.3 | Http service has already been stopped2015-12-17 13:08:23,245 | WARN | Thread-34 | HttpServiceStopped | 163 - org.ops4j.pax.web.pax-web-runtime - 4.2.3 | Http service has already been stopped
--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
first of all, in your sample tracking the webconsole should be tracked by a service tracker ;)
It's crucial to register your httpContext as a shared Context, with the already given properties (if you use Pax-Web 6.0, it'll do this in a OSGi R6 like manner)
To create such a shared context you can use the webcontainer.createDefaultSharedHttpContext (or the like)
This context should be created by the Servlet Bundle, the filters should be attached accordingly if the correct context type ist found.
httpContextRegistration = context.registerService(HttpContext.class,httpContext, properties);
You received this message because you are subscribed to a topic in the Google Groups "OPS4J" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ops4j/iKvj-qu7gS4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ops4j+un...@googlegroups.com.
Hashtable<String, String> props = new Hashtable<String, String>(); props.put(ExtenderConstants.PROPERTY_URL_PATTERNS, "/sharedContext/*"); props.put(ExtenderConstants.PROPERTY_HTTP_CONTEXT_ID, "shared"); props.put(ExtenderConstants.PROPERTY_HTTP_CONTEXT_SHARED, "true"); filterReg = context.registerService(Filter.class,new SimpleOnlyFilter(), props);