Hey Roy No this is not possible. The SlingHttpServletRequest is only available once you're "inside" the SlingMainServlet, i.e. in filters or servlets registered within Sling. The HTTP Whiteboard is pure OSGi and filters registered that way are executed before the SlingMainServlet.
The order of execution is something like this (in reality it is more complicated once inside the SlingMainServlet): 1. OSGi HTTP Service filter chain 2. SlingMainServlet (SlingHttpServletRequest/Response available after this point) 3. Sling filter chain (i.e. Filters registered with "sling.filter.scope") 4. Sling servlet / script (e.g. Servlets registered with "sling.servlet.resourceTypes") Regards Julian On Mon, Nov 16, 2020 at 4:37 PM Roy Teeuwen <r...@teeuwen.be> wrote: > > Hey all, > > I would like to retrieve the SlingHttpServletRequest in a filter that has > been registered through the HTTP whiteboard instead of registering it with > OSGi DS and implementing the Filter service interface. Is this possible? > > The code of the registration of the filter: > > https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/fe1d698b3012909597490690b4fbcd054a10f4fa/bundle/src/main/java/com/adobe/acs/commons/http/headers/impl/AbstractDispatcherCacheHeaderFilter.java#L180 > > <https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/fe1d698b3012909597490690b4fbcd054a10f4fa/bundle/src/main/java/com/adobe/acs/commons/http/headers/impl/AbstractDispatcherCacheHeaderFilter.java#L180> > > I already tried to set the context to org.apache.sling instead of *, but > still when I debug the code, the request you get in the doFilter is the > I18n…Request > > If this is not possible, how can you register a Filter programatically that > its inside the SlingHttpServletRequest chain? > > Greets, > Roy