[
https://issues.apache.org/jira/browse/FELIX-6080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Amit Mondal closed FELIX-6080.
------------------------------
_HttpSessionListener_ has to be explicitly registered with the same context
that the servlet uses to create a session.
> HttpSessionListeners ain't getting triggered
> --------------------------------------------
>
> Key: FELIX-6080
> URL: https://issues.apache.org/jira/browse/FELIX-6080
> Project: Felix
> Issue Type: Bug
> Components: HTTP Service
> Reporter: Amit Mondal
> Priority: Major
>
> I am currently struggling with HTTP Whiteboard Session Listener. The custom
> _HttpSessionListener_ callbacks are never getting triggered when
> _HttpRequest#getSession()_ is invoked in servlets.
>
> As an example,
> {code:java}
> @Component
> @HttpWhiteboardListener
> public final class ApplicationSession implements HttpSessionListener {
> private final AtomicInteger activeSessions = new AtomicInteger();
> @Override
> public void sessionCreated(final HttpSessionEvent sessionEvent) {
> activeSessions.incrementAndGet();
> }
> @Override
> public void sessionDestroyed(final HttpSessionEvent sessionEvent) {
> activeSessions.decrementAndGet();
> }
> public boolean isSessionValid() {
> return activeSessions.get() != 0;
> }
> }
> {code}
>
> This is the custom listener I registered with the HTTP Whiteboard and it
> never gets invoked when I call _HttpRequest#getSession()_.
> The SCR Component is ACTIVE, that means, it is not ignored but never
> triggered.
>
> GitHub Repo replicating the problem:
> [https://github.com/amitjoy/whiteboard-httplistener-problem]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)