code: private ServletContextDTO mapServletContext(Map.Entry<ServiceReference<ServletContext>, ServletContext> mapEntry) {
          final ServiceReference<ServletContext> ref = mapEntry.getKey();
          final ServletContext servletContext = mapEntry.getValue();
  
          ServletContextDTO dto = new ServletContextDTO();
          dto.serviceId = (long) ref.getProperty(Constants.SERVICE_ID);
          // the actual ServletContext might use "" instead of "/" (depends on the
          // container). DTO must use "/" for root
          dto.contextPath = servletContext.getContextPath().trim().length() == 0 ? "/" : servletContext.getContextPath();
          dto.name = servletContext.getServletContextName();
  
          dto.attributes = Collections.list(servletContext.getAttributeNames()).stream()
                  .map(name -> new SimpleEntry<>(name, servletContext.getAttribute(name)))
                  .collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue));
          dto.initParams = Collections.list(servletContext.getInitParameterNames()).stream()
                  .map(name -> new SimpleEntry<>(name, servletContext.getInitParameter(name)))
                  .collect(Collectors.toMap(SimpleEntry::getKey, SimpleEntry::getValue));
  
          return dto;
      }
docs: /*
  Maps a default context (whithout whiteboard-service) to a ServletContextDTO