We're updating the issue view to help you get more done. 

Http Whiteboard: Resolution of ServletContextHelper

Description

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.

...

osgi.http.whiteboard.context.name:

Name of the Servlet Context Helper. This name can be referred to by Whiteboard services via the osgi.http.whiteboard.context.select 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.

Environment

None

Status

Assignee

Grzegorz Grzybek

Reporter

J Brébec

Labels

None

Components

Fix versions

Priority

Major