Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Trigger HttpSessionBindingListener in AEM

Avatar

Level 4

Hi, 

I am trying to trigger the valueBound method of HttpSessionBindingListener. Whenever I set the session attribute.It is not working.

I have written class which implements HttpSessionBindingListener 

like

public class SessionBinding implements HttpSessionBindingListener, java.io.Serializable  {

@Override
    public  void valueBound(HttpSessionBindingEvent paramHttpSessionBindingEvent) {
        LOG.info("Session bounded ");
        
    }

@Override
    public void valueUnbound(
            HttpSessionBindingEvent paramHttpSessionBindingEvent) {}

}

In my servlet,

SlingServlet(paths = "/bin/testing", methods = "POST")
public class TestServlet extends SlingAllMethodsServlet {

protected void doGet(SlingHttpServletRequest request,
            SlingHttpServletResponse response) throws ServletException,
            IOException {

HttpSession session = request.getSession();
        session.setAttribute("test", "test");

}

}

I set session attribute.But it doesnt called my valueBound method

Could some one help me to resolve this issue. 

Am I missing any configuration here?

Thanks

Nanda

1 Reply