[ 
https://issues.apache.org/jira/browse/FELIX-6080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16790879#comment-16790879
 ] 

Amit Mondal commented on FELIX-6080:
------------------------------------

[~cziegeler] I have registered the custom _HttpSessionListener_ with the same 
context used by the servlet that creates a session using 
_HttpRequest#getSession()_

The _HttpSessionListener_ callbacks are still not triggered.

The _HttpSessionListener_ is consumed by Jetty bundle though.
{code:java}
Component Description: 
com.amitinside.sample.http.extender.session.ApplicationSession
=====================================================================================
Class:         com.amitinside.sample.http.extender.session.ApplicationSession
Bundle:        1 (com.amitinside.sample.http.extender:0.0.0)
Enabled:       true
Immediate:     false
Services:      [com.amitinside.sample.http.extender.session.ApplicationSession, 
javax.servlet.http.HttpSessionListener]
Scope:         singleton
Config PID(s): 
[com.amitinside.sample.http.extender.session.ApplicationSession], Policy: 
optional
Base Props:    (2 entries)
  osgi.http.whiteboard.context.select<String> = 
(osgi.http.whiteboard.context.name=SampleContext1)
  osgi.http.whiteboard.listener<Boolean> = true

Component Configuration Id: 4
-----------------------------
State:        ACTIVE
Service:      34 
[com.amitinside.sample.http.extender.session.ApplicationSession, 
javax.servlet.http.HttpSessionListener]
    Used by bundle 1 (com.amitinside.sample.http.extender:0.0.0)
    Used by bundle 6 (org.apache.felix.http.jetty:4.0.8)
Config Props: (4 entries)
  component.id<Long> = 4
  component.name<String> = 
com.amitinside.sample.http.extender.session.ApplicationSession
  osgi.http.whiteboard.context.select<String> = 
(osgi.http.whiteboard.context.name=SampleContext1)
  osgi.http.whiteboard.listener<Boolean> = true
References:   (total 0)

{code}
I have also updated the repo accordingly if you want to have a look.

 

> 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)

Reply via email to