Http Whiteboard: Resolution of ServletContextHelper


The resolution of the ServletContextHelper is not compliant to the R6 specification.

  • The whiteboard implementation should be using the bundle of the whiteboard element in order to get the ServletContextHelper selected by this element

  • It should be possible to override any ServletContextHelper (including the default one) by registering a ServletContextHelper with the same name and a larger service ranking

From the specification :

140.2 The Servlet Context

To achieve the required behavior for ServletContext.getClassLoader() each bundle must be provided with a separate Servlet Context instance to serve the classloader of the Whiteboard services for that bundle. For more information see getClassLoader() in Table 140.2 on page 759.
Some implementations of the ServletContextHelper may be implemented using a Service Factory, for example to provide resources from the associated bundle, as the default implementation does. Therefore the Whiteboard implementation must get the Servlet Context Helper using the Bundle Context of the bundle that registered the Whiteboard service.


Name of the Servlet Context Helper. This name can be referred to by Whiteboard services via the property. The syntax of the name is the same as the syntax for a Bundle Symbolic Name. The default Servlet Context Helper is named default. To override the default, register a custom ServletContextHelper service with the name default. If multiple Servlet Context Helper services are registered with the same name, the one with the highest Service Ranking is used. In case of a tie, the service with the lowest service ID wins. In other words, the normal OSGi service ranking applies.
Registrations with an invalid or unspecified name are not used and reflected in the failure DTOs. See HTTP_WHITEBOARD_CONTEXT_NAME.




Grzegorz Grzybek
January 24, 2019, 9:12 AM

ServletContext method





Returns the class loader of the bundle that regis-
tered the Whiteboard service. An implementa-
tion of this specification can achieve this by re-
turning separate façades of the ServletContext
to each Whiteboard service. Each façade access-
es the Whiteboard service's Bundle Wiring to ob-
tain its classloader.


Grzegorz Grzybek


Jérémie Brébec




Fix versions