knopflerfish / knopflerfish.org

Knopflerfish OSGi Service Platform. OSGi run-time container and SDK source code repo
http://www.knopflerfish.org
BSD 3-Clause "New" or "Revised" License
33 stars 11 forks source link

API question: HttpService registerServlet and registerResources enumeration #56

Open lykkja opened 3 years ago

lykkja commented 3 years ago

Dear all, Is there a way to query the HttpService or registered servlets and/or resources. This can be useful in managing the HttpServlet and security assessment of the OSGi environment. Numerous bundles can register servlets, and it is difficult for an administrator of the OSGi environment to assess if a bundle is exposing servlets or not. Such an API enables extra inspection of of servelts exposing Web services.

chlarsson commented 2 years ago

Hi, apologies for the late reply. There's no such API. There is however a console command that does more or less what you are asking for. It's the http command group, and list -r will provide the following:

http> list -r
Configured HTTP Servers
# 0: org.knopflerfish.bundle.http.factory.HttpServer.default #
  http: 8080  Open
  https: 443  Closed (pending no SSL Server Socket Factory registered)
  Registrations
    '/docs'
      Resource registered by bundle: #38 - org.knopflerfish.bundle.httproot-IMPL
    '/servlet/knopflerfish-info'
      Servlet registered by bundle: #38 - org.knopflerfish.bundle.httproot-IMPL
    '/'
      Resource registered by bundle: #38 - org.knopflerfish.bundle.httproot-IMPL
http>