"bindServlet: Servlet service not available from reference {}",
reference);
return false;
}
ServletResourceProvider provider = servletResourceProviderFactory.create(
reference, servlet);
if (provider == null) {
log.error(
"createServlet: Cannot register servlet {} without path or resource type configuration",
name);
return false;
}
try {
servlet.init(new SlingServletConfig(servletContext, reference, name));
log.debug("bindServlet: Servlet {} added", name);
} catch (ServletException ce) {
log.error("bindServlet: Component " + name
+ " failed to initialize", ce);
return false;
} catch (Throwable t) {
log.error("bindServlet: Unexpected problem initializing component "
+ name, t);
return false;
}
Dictionary<String, Object> params = new Hashtable<String, Object>();
params.put(ResourceProvider.ROOTS, provider.getSerlvetPaths());
params.put(Constants.SERVICE_DESCRIPTION,
"ServletResourceProvider for Servlets at "
+ Arrays.asList(provider.getSerlvetPaths()));
ServiceRegistration reg = context.getBundleContext().registerService(
ResourceProvider.SERVICE_NAME, provider, params);
servletsByReference.put(reference, reg);