Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11677

Sling Engine Context 'org.apache.sling' has higher ranking than 'default' context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Engine
    • None

    Description

      When a servlet is registered with the OSGi HTTP Whiteboard pattern without the property osgi.http.whiteboard.context.select the "default" context helper is used (https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.common.properties)

      With the Jetty Implementation from Felix in Sling this has the service.ranking Integer.MIN_VALUE (https://github.com/apache/felix-dev/blob/e7d17aca517949dd65a913f9ac5088e653a4a2dc/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java#L182) while the one for the default Sling Main Servlet has no explicit ranking (i.e. 0). That leads to the fact that the Sling Main servlet always takes precedence as

      In the case of two Servlet Context Helpers with the same path, the service with the highest ranking is searched first for a match. In the case of a tie, the lowest service ID is searched first.

      (https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.servletcontext) as both "default" and "org.apache.sling" are registered for path "<root>".

      The Sling Main servlet context should use a lower ranking so that simple servlets registered via OSGI HTTP Whiteboard pattern without explicit context can kick in at all!

      Attached the web console of Sling Starter 12:

      Attachments

        1. HTTP-Service-Default-Context.png
          181 kB
          Konrad Windszus
        2. Servlet-Contexts.png
          181 kB
          Konrad Windszus

        Issue Links

          Activity

            People

              kwin Konrad Windszus
              kwin Konrad Windszus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m