public HttpService addingService(ServiceReference<HttpService> reference) {
final HttpService httpService = (HttpService) bundleContext
.getService(reference);
if (httpService != null) {
final HttpContext httpContext = httpService.createDefaultHttpContext();
final Dictionary<String, Object> initParams = new Hashtable<String, Object>();
try {
httpService.registerServlet("/hello", new HelloServlet(), initParams, httpContext);
httpService.registerServlet("/hello/logo", new HelloImage(), initParams, httpContext);
httpService.registerResources("/images", "/images", httpContext);
} catch (ServletException e) {
e.printStackTrace();
} catch (NamespaceException e) {
e.printStackTrace();
}
}
return httpService;
}