Jonathan Wright created FELIX-6791:
--------------------------------------
Summary: Only a single format can be allowed when using Pax Web
Key: FELIX-6791
URL: https://issues.apache.org/jira/browse/FELIX-6791
Project: Felix
Issue Type: Bug
Components: Health Checks
Affects Versions: healthcheck.core 2.1.0, healthcheck.core 2.0.14
Environment: org.apache.felix.healthcheck.core 2.0.14
org.ops4j.pax.web.pax-web-spi 8.30.0
Reporter: Jonathan Wright
Attachments: stacktrace.txt
{{HealthCheckExecutorServlet}} registers a new instance of
{{HealthCheckExecutorServlet$ProxyServlet}} for each allowed format. However,
it does not supply a unique name for each instance. This violates [Section
102.2|https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.http.html#i1223311]
of the OSGi Http Service Specification, which includes the following statement:
{quote}All {{Servlet}} objects and resource registrations share the same
name-space. If an attempt is made to register a resource or {{Servlet}} object
under the same name as a currently registered resource or {{Servlet}} object, a
{{NamespaceException}} is thrown.
{quote}
Pax Web enforces the above mentioned requirement (see [^stacktrace.txt]). As a
result, only one instance of {{HealthCheckExecutorServlet$ProxyServlet}} is
registered. To prevent {{Servlet}} registration errors when using Pax Web, you
have to set the {{allowed.formats}} configuration property to a single value,
e.g. {{{}allowed.formats=["json"]{}}}.
You cannot specify a name when registering a {{Servlet}} via the
{{org.osgi.service.http.HttpService}} API, so the 2.0.14 version of
{{HealthCheckExecutorServlet}} would need to be updated to use the Whiteboard
Pattern. The 2.1.0 version, which does use the Whiteboard Pattern, simply needs
to specify a unique {{osgi.http.whiteboard.servlet.name}} property value for
each {{HealthCheckExecutorServlet$ProxyServlet}} instance.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)