[
https://issues.apache.org/jira/browse/FELIX-6080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16790523#comment-16790523
]
Carsten Ziegeler commented on FELIX-6080:
-----------------------------------------
[~amitmondal] It seems that you're registering your listener with the default
context while your servlets use a specific context:
https://github.com/amitjoy/whiteboard-httplistener-problem/blob/master/com.amitinside.sample.http.extender/src/main/java/com/amitinside/sample/http/extender/servlet/SampleServlet1.java#L26
You need to register your servlet and listeners in the same context
> 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
> Affects Versions: http.jetty-4.0.6, http.jetty-4.0.8
> 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)