use of org.apache.felix.http.base.internal.whiteboard.tracker.PreprocessorTracker in project felix by apache.
the class WhiteboardManager method start.
/**
* Start the whiteboard manager
* @param containerContext The servlet context
*/
public void start(final ServletContext containerContext, @Nonnull final Dictionary<String, Object> httpServiceProps) {
// runtime service gets the same props for now
this.serviceRuntime.setAllAttributes(httpServiceProps);
this.serviceRuntime.setAttribute(HttpServiceRuntimeConstants.HTTP_SERVICE_ID, Collections.singletonList(this.httpServiceFactory.getHttpServiceServiceId()));
this.runtimeServiceReg = this.httpBundleContext.registerService(HttpServiceRuntime.class, serviceRuntime, this.serviceRuntime.getAttributes());
this.serviceRuntime.setServiceReference(this.runtimeServiceReg.getReference());
this.webContext = containerContext;
// add context for http service
final List<WhiteboardContextHandler> list = new ArrayList<>();
final ServletContextHelperInfo info = new ServletContextHelperInfo(Integer.MAX_VALUE, HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID, HttpServiceFactory.HTTP_SERVICE_CONTEXT_NAME, "/", null);
list.add(new HttpServiceContextHandler(info, registry.getRegistry(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID), httpServiceFactory, webContext, this.httpBundleContext.getBundle()));
this.contextMap.put(HttpServiceFactory.HTTP_SERVICE_CONTEXT_NAME, list);
// add default context
final Dictionary<String, Object> props = new Hashtable<>();
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME, HttpWhiteboardConstants.HTTP_WHITEBOARD_DEFAULT_CONTEXT_NAME);
props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH, "/");
props.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE);
this.defaultContextRegistration = httpBundleContext.registerService(ServletContextHelper.class, new ServiceFactory<ServletContextHelper>() {
@Override
public ServletContextHelper getService(final Bundle bundle, final ServiceRegistration<ServletContextHelper> registration) {
return new ServletContextHelper(bundle) {
};
}
@Override
public void ungetService(final Bundle bundle, final ServiceRegistration<ServletContextHelper> registration, final ServletContextHelper service) {
// nothing to do
}
}, props);
addTracker(new FilterTracker(this.httpBundleContext, this));
addTracker(new ListenersTracker(this.httpBundleContext, this));
addTracker(new PreprocessorTracker(this.httpBundleContext, this));
addTracker(new ResourceTracker(this.httpBundleContext, this));
addTracker(new ServletContextHelperTracker(this.httpBundleContext, this));
addTracker(new ServletTracker(this.httpBundleContext, this));
this.plugin.register();
}
Aggregations