felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Driessen" <thomas.driessen...@gmail.com>
Subject Re: HTTP Whiteboard HttpSessionListener Problem
Date Fri, 08 Mar 2019 12:53:00 GMT
Hi Amit,

maybe this is a similar issue as the one I had with 
ServletContextListeners? See here: 
https://issues.apache.org/jira/browse/FELIX-6049

In order to rule that out maybe you could try to register your 
HttpSessionListener not via the ComponentPropertyType annotation but 
with a plain property like this:

@Component(property= {HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER + 
"=true"})


Be aware that the property value has to be of type String and not of 
type boolean!
If this solves your problem then you should update your dependencies as 
in the new versions of Felix Jetty this bug should be fixed.

Kind regards,
Thomas
------ Originalnachricht ------
Von: "Amit" <admin@amitinside.com>
An: users@felix.apache.org
Gesendet: 08.03.2019 13:20:49
Betreff: HTTP Whiteboard HttpSessionListener Problem

>Hi,
>
>I am currently struggling with HTTP Whiteboard Session Listener. I have 2 servlets that
use their own ServletContextHelpers and ServletFilters which are registered for both the aforementioned
Servlet Contexts. The filters and servlets are working as expected but the custom HttpSessionListener
callbacks are never getting triggered when HttpRequest#getSession() is invoked in one of the
servlets.
>
>As an example,
>
>@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;
>     }
>
>}
>
>This is the custom listener I registered with the HTTP Whiteboard and it never gets invoked
when I call HttpRequest#getSession().
>
>Is there anything I am missing? I would really appreciate further help on this regard.
For your information, I am currently using the latest version of Felix Jetty Bundle (4.0.6).
>
>Thanks and Regards,
>
>Amit Kumar Mondal
>Phone: +49 160 9100 3436  Email: amit@amitinside.com
>Skype: arsenalnerk   GitHub: amitjoy
>Blog: blog.amitinside.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message