code: private synchronized void getAndSetRESTHandlerContainer(HttpServletRequest request) throws ServletException {
          if (REST_HANDLER_CONTAINER == null) {
              //Get the bundle context
              HttpSession session = request.getSession();
              ServletContext sc = session.getServletContext();
              BundleContext ctxt = (BundleContext) sc.getAttribute("osgi-bundlecontext");
  
              ServiceReference<RESTHandlerContainer> ref = ctxt.getServiceReference(RESTHandlerContainer.class);
  
              if (ref == null) {
                  // Couldn't find service, so throw the error.
                  throw new ServletException(TraceNLS.getFormattedMessage(this.getClass(),
                                                                          TraceConstants.TRACE_BUNDLE_CORE,
                                                                          "OSGI_SERVICE_ERROR",
                                                                          new Object[] { "RESTHandlerContainer" },
                                                                          "CWWKO1001E: OSGi service {0} is not available."));
              } else {
                  REST_HANDLER_CONTAINER = ctxt.getService(ref);
              }
          }
      }
docs: Grabs the RESTHandlerContainer from the OSGi service registry and stores
  it to {@link #REST_HANDLER_CONTAINER}.
  
  @param request The HttpServletRequest from which we'll get the OSGi BundleContext
  @throws ServletException When the RESTHandlerContainer service is unavailable