[ https://issues.apache.org/jira/browse/SLING-11677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Konrad Windszus updated SLING-11677: ------------------------------------ Description: When a servlet is registered with the OSGi HTTP Whiteboard pattern without the property {{osgi.http.whiteboad.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}} 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 {quote} 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. {quote} (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: !Servlet-Contexts.png! was: When a servlet is registered with the OSGi HTTP Whiteboard pattern without the property {{osgi.http.whiteboad.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}} 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 {quote} 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. {quote} (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! > Sling Engine Context 'org.apache.sling' has higher ranking than 'default' > ------------------------------------------------------------------------- > > Key: SLING-11677 > URL: https://issues.apache.org/jira/browse/SLING-11677 > Project: Sling > Issue Type: Bug > Components: Engine > Reporter: Konrad Windszus > Priority: Major > Attachments: Servlet-Contexts.png > > > When a servlet is registered with the OSGi HTTP Whiteboard pattern without > the property {{osgi.http.whiteboad.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}} 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 > {quote} > 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. > {quote} > (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: > !Servlet-Contexts.png! -- This message was sent by Atlassian Jira (v8.20.10#820010)