Hello,

I have about 30 servlet contexts (ServletContextHelper) scattered across
multiple bundles. One of these context (WebviewerServletContextHelper) has
"osgi.http.whiteboard.context.path=/".
I also have one bundle containing all servletFilters for these servlet
contexts. These filters mostly for session manipulation and security checks
so If the request does not pass through these filters, it will cause
exception when arriving at the servlet. Thus, i want to use
ServiceUnavailableFilter from healthcheck to make sure that my filters (and
other components) are ready before accepting http requests. I made the
config file for ServiceUnavailableFilter as follow:

osgi.http.whiteboard.filter.regex=(?!/system/).*
osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name
=WebviewerServletContextHelper)
tags=systemalive
responseTextFor503=Service Unavailable, wait.. wait... wait....
service.ranking=1
avoid404DuringStartup=true

I set service.ranking=1 because i'm running pax-web and it seems to execute
filters in ascending ranking. I also set avoid404DuringStartup=true and
start level of healthcheck.core to level 3 (default is 4) because I want
this filter to be up before my servlets and filters (default level 4).
However, I always see "INFO  o.a.f.h.c.i.f.ServiceUnavailableFilter -
ServiceUnavailableFilter active (start level 4)" which indicates the
component has been activated but the ServiceUnavailableFilter never process
any request.

So here are some questions
1. In a dynamic env like osgi container, how can we be sure that a request
always be processed by a filter before arriving at the servlet? Bundles do
not always start in the same order thus a filter may be registered after
the servlet it supposed to protect
2. Even when i waited for a long period after starting my server and
healthcheck return OK for all of my checks, why does
ServiceUnavailableFilter not handle any request?

About my env, I'm using
org.apache.felix.healthcheck.annotation_2.0.0
org.apache.felix.healthcheck.api_2.0.0
org.apache.felix.healthcheck.core_2.0.6
org.apache.felix.healthcheck.generalchecks_2.0.4
and pax-web 7.2.4 in equinox (org.eclipse.osgi_3.12.0.v20170512-1932)

Hope someone can shed a light

Thai

Reply via email to